Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Hilton
Newbie


Joined: 14 Dec 2003
Posts: 4
Location: Canada

PostPosted: Sun Dec 14, 2003 5:55 pm   

{} around parameters, and mystery buttons
 
Okay so, I've got this simple script I was working on. It is a series of small buttons along one edge of the screen, showing my current spell effects, etc.

During this, I got tired of creating the buttons and triggers by hand, and wrote an alias to do it for me (see below).

Now, I have two questions.
One, how can I strip the { } from the parameters? Obviously, I need to use { } to make parameters with spaces as one value; but zMud isn't stripping them off for me, as I thought it would. Is there an alternate way to do this, or a simple way to safely strip the outer braces? (I don't necessarily want to remove them ALL, in case there are some within the triggers or something)

Two, before I added the parameter check (#IF, 2nd line), a couple of button/trigger sets got created with blank values. After extensive searching, I can not find ANY #BUTTON commands that shouldn't be there, in any file, any class. Yet, there are two blank buttons in my zMud (even after multiple restarts, and Class Script repastes). I can post my main and inherited .mud files, if needed.

#ALIAS CreateSpellButton {
#SAY
#IF (%null( %1) | %null( %2) | %null( %3) | %null( %4)) {
#SAY Usage: CreateSpellButton ~{Name~} ~{Class~} ~{TriggerOn~} ~{Trigger Off~}
#ABORT 1
} {#NOOP}
#SAY Creating Button '%1' in class 'Spell|Character|%2'
#SAY Spell Start Trigger: '%3'
#SAY Spell End Trigger: '%4'
#CLASS Character|Spell|%2
#TRIGGER {%4} {spell.%2 = 0}
#TRIGGER {%3} {spell.%2 = 1}
#BUTTON 1 {%1} {} {%1} {} {@spell.%2 = 0} {1} {} {} {} {} {} {} {} {31} {111} {} {} "" {Explore} {} {}
#CLASS 0
}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 15, 2003 6:32 am   
 
To find the blank buttons, just right-click on them. The Settings Editor should open with the appropriate setting already selected. If it doesn't, you might need to enable Show Hidden or Show Inherited on the editor's View menu.

You can shorten the #IF condition using %numparam().
#IF (%numparam() < 4) {error message} {make button}

Since you're the one using this alias, and you wrote it, you should know to always put {} around the parameters, so you don't need to include them in the other commands. You should also know enough to make %2 a single word, so that you won't need {} around it.

With all that in mind, you can revise the alias to something like this:
#AL CreateSpellButton {
#SA
#IF (%numparam() < 4)) {
#SA Usage: CreateSpellButton ~{Name~} Class ~{TriggerOn~} ~{Trigger Off~}
} {
#SA Creating Button '%1' in class 'Spell|Character|%2'
#SA Spell Start Trigger: '%3'
#SA Spell End Trigger: '%4'
#CLA Character|Spell|%2
#TR %4 {spell.%2 = 0}
#TR %3 {spell.%2 = 1}
#BU 0 %1 {} %1 {} {@spell.%2 = 0} {1} {} {} {} {} {} {} {} {31} {111} {} {} "" {Explore} {} {}
#CLA 0
}}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net