|
Jesmen Newbie
Joined: 02 Jan 2012 Posts: 2
|
Posted: Mon Jan 02, 2012 7:49 pm
Need help with #Switch in DragonRealms (SOLVED) |
I am trying to create a switch command to cast a spell on a rotating basis. It will trigger everytime CMUD see's the words "you also see". The variable Spellnum has already been created and set to 1 from a different trigger. I have checked that trigger and it is working properly. My assumption for it not working is that I am tryiing to make it do too much OR I've missed some minor syntex. Below you will find my commands exactly as I have them in my script starting with #show.
#Show is just to help me debug the Switch command to make sure it is assigning a new number to my variable Spellnum. What I am trying to do is that whenever the switch command triggers it looks at the number in the Spellnum variable, executes that command (which is preparing a spell at 15 mana) THEN assigne a new number to the variable Spellnum. Then the command should wait 2 seconds and then execute the game command Parry.
Some problems may be that I am an old man with failing eyesight and can't distinguish between paratheisis and braces.
I need to put the ; symbol after the braces at the end of each line.
Switch can only execute one command per line not two commands per line (I do know that once switch finds a match for the variable it executes those commands and doesn't look for any other matches
Trigger = "you also see
#show @Spellnum;
#Switch(@Spellnum=1){Prepare sw 15;#variable Spellnum = 2}
(@Spellnum=2){Prepare es 15;#variable Spellnum = 3}
{@Spellnum=3}{Prepare suf 15;#variable Spellnum = 4}
{@Spellnum=4}{Prepare ala 15;target troll;#variable = 1}
#wait 2000;parry;
When I run the trigger I get the following error message:
ERROR: Trigger "you also see " fired but did not compile
Any help, hints suggestions, comments or funny limericks would be appreciated
Jesmen |
|
Last edited by Jesmen on Mon Jan 02, 2012 11:25 pm; edited 1 time in total |
|
|
|
hogarius Adept
Joined: 29 Jan 2003 Posts: 221 Location: islands.genesismuds.org
|
Posted: Mon Jan 02, 2012 8:34 pm |
I think you need to remove the quote marks (") at the beginning of the pattern.
You need spaces between the parameters in the #SWITCH command.
(@Spellnum=3) and (@Spellnum=4) should have parentheses around them, not curly braces.
If you use the #VARIABLE command, you don't need the equal sign; again, you should use spaces between the parameters.
You forgot to specify the Spellnum variable in the 4th line of the #Switch command.
If you use carriage returns to separate commands, you don't need the semicolon (;) at the end.
If you use multiple lines in commands like #SWITCH, you need to indent the 2nd and following lines with 2 spaces. This is stated in the online documentation for the #SWITCH command.
Code: |
Pattern: You also see
#show @Spellnum
#Switch (@Spellnum=1) {Prepare sw 15;#variable Spellnum 2}
(@Spellnum=2) {Prepare es 15;#variable Spellnum 3}
(@Spellnum=3) {Prepare suf 15;#variable Spellnum 4}
(@Spellnum=4) {Prepare ala 15;target troll;#variable Spellnum 1}
#wait 2000;parry |
|
|
Last edited by hogarius on Mon Jan 02, 2012 10:18 pm; edited 1 time in total |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Mon Jan 02, 2012 10:01 pm |
This alternative syntax might be easier to read:
Code: |
#SWITCH (@Spellnum)
(1) {Prepare sw 15;#variable Spellnum 2}
(2) {Prepare es 15;#variable Spellnum 3}
(3) {Prepare suf 15;#variable Spellnum 4}
(4) {Prepare ala 15;target troll;#variable Spellnum 1} |
|
|
|
|
Jesmen Newbie
Joined: 02 Jan 2012 Posts: 2
|
Posted: Mon Jan 02, 2012 11:27 pm |
Thanks guys. That solved the problem. I can't believe that for all the times I stared at that problem I didn't realised that I had forgotten to include the Variable name for my 4 line.
I cut and pasted your condensed version Daern and it works like a charm. Thank you for your help
Jesmen |
|
|
|
|
|