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
sarim
Newbie


Joined: 14 May 2003
Posts: 9

PostPosted: Thu Sep 11, 2003 1:23 am   

rescue trigger
 
ok here's the trigger i can't get it to recognize when people need to be rescued I can point out where i think the problem is but have no idea how to solve it. I would really appreciate some help btw this is 6.62version:

#CLASS {zonerescue}
#ALIAS querescue {#var whom %1;#var priority %2;#IF (@priority==1) { #VAR rescue1 %ADDITEM( @whom, @rescue1)};#IF (@priority==2) {#VAR rescue2 %ADDITEM( @whom, @rescue2)};#IF (@priority==3) { #VAR rescue3 %ADDITEM( @whom, @rescue3)};#IF (@inrescue!=1) { dorescue}} : This is where i think one of the problems are with the @inrescue!=1
#ALIAS dorescue {#VAR torescue %item( @rescue1, 1);#IF (@torescue=="") {#VAR torescue %item( @rescue2, 1)};#IF (@torescue=="") {#VAR torescue %item( @rescue3, 1)};#IF (@torescue!="") {#VAR inrescue 1;rescue @torescue}} : And right here with the @torescue!=""
#ALIAS rescuecomplete {#VAR inrescue 0;#IF %ismember( @torescue, @rescue1) { #VAR rescue1 %delitem @torescue,rescue1};#IF %ismember( @torescue, @rescue2) { #VAR rescue2 %delitem @torescue,rescue2};#IF %ismember( @torescue, @rescue3) { #VAR rescue3 %delitem @torescue,rescue3}}
#CLASS 0

#CLASS {zonerescue}
#TRIGGER {({@attack}) ({@clerics})} {#IF (%ismember( %2, @rescue1)==0) { querescue %2 1}}
#TRIGGER {({@attack}) ({@casters})} {#IF (%ismember( %2, @rescue2)==0) { querescue %2 2}}
#TRIGGER {({@attack}) ({@psi})} {#IF (%ismember( %2, @rescue3)==0) { querescue %2 3}}
#TRIGGER {Banzai! To the rescue...} {#ECHO **************** RESCUED @torescue **********************;rescuecomplete;dorescue}
#TRIGGER {Maybe you should get on your feet first?} {#IF (@inrescue==1) { dorescue}}
#TRIGGER {But nobody is fighting} {#var inrescue 0;rescuecomplete;dorescue}
#TRIGGER {Who do you want to rescue?} {#ECHO *********** CANNOT RESCUE @torescue **************;rescuecomplete;#var inrescue 0;dorescue}
#TRIGGER {You fail the rescue.} {dorescue}
#TRIGGER {you follow} {#var rescue1 "";#var rescue2 "";#var rescue3 ""}
#CLASS 0

#CLASS {zonerescue}
#VAR attack {"wounds"|"hits"|"grazes"|"enshrouds"|"absolutely destroys"|"mighty kick sends"|"nearly slaughters"|"beats the crap out of"}
#VAR clerics {"Donken"|"Ehlissa"|"Tran"|"Golrith"|"Avena"|"Xia"|"Banda"}
#VAR casters {"Xeron"|"Xuen"|"Consola"|"Whorg"|"Xavio"|"Xziz"|"Karnik"|"Ishta"|"Xanth"|"Darg"|"Peeblo"|"Oraks"|"Nazl"|"Aktosh"}
#VAR psi {"Kju"|"Miz"|"Majid"|"Zalta"|"Allyciss"}
#CLASS 0
I didn't right this script and basically cannot code at all. Any help would be greatly apprecaited.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Sep 11, 2003 2:34 am   
 
Believe it or not the script is fine. The problem appears to be in the variables.

#VAR attack {"wounds"|"hits"|"grazes"|"enshrouds"|"absolutely destroys"|"mighty kick sends"|"nearly slaughters"|"beats the crap out of"}
#VAR clerics {"Donken"|"Ehlissa"|"Tran"|"Golrith"|"Avena"|"Xia"|"Banda"}
#VAR casters {"Xeron"|"Xuen"|"Consola"|"Whorg"|"Xavio"|"Xziz"|"Karnik"|"Ishta"|"Xanth"|"Darg"|"Peeblo"|"Oraks"|"Nazl"|"Aktosh"}
#VAR psi {"Kju"|"Miz"|"Majid"|"Zalta"|"Allyciss"}

There shouldn't be double quotes in them. This generally wouldn't cause a problem, but appears to cause the triggers to not activate. Using the %stripq function with each variable will fix this.
#VAR attack {%stripq(@attack)}
#VAR casters {%stripq(@casters)}
#VAR clerics {%stripq(@clerics)}
#VAR psi {%stripq(@psi)}
Reply with quote
sarim
Newbie


Joined: 14 May 2003
Posts: 9

PostPosted: Thu Sep 11, 2003 2:45 am   
 
i am still getting syntax errors with the ! in querescue and i think do rescue...could that be what's causing it?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Sep 11, 2003 7:09 pm   
 
quote:

#IF (@inrescue!=1) {dorescue}



yes, that could be a problem. Generally you should separate variables (red), operators (blue), and literals (green) with spaces. Without spaces, ZMud might confuse the command and either do something else entirely (ie, create a variable named @inrescue!, which I think is illegal) or throw up a false-positive syntax error.
Reply with quote
sarim
Newbie


Joined: 14 May 2003
Posts: 9

PostPosted: Thu Sep 11, 2003 10:17 pm   
 
ok i tried that and it still is giving me a syntax error pointing at the ! could it be that command doesn't register or something?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Sep 11, 2003 11:22 pm   
 
maybe you're missing a curly brace, or you have a surplus of them.
Reply with quote
sarim
Newbie


Joined: 14 May 2003
Posts: 9

PostPosted: Thu Sep 11, 2003 11:32 pm   
 
yea umm i have no idea how to code at all heh...
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