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
Casius
Novice


Joined: 03 Sep 2004
Posts: 34

PostPosted: Tue Feb 15, 2005 2:30 am   

#if commands
 
This is what i am trying to do. I am trying to keep mydefences up.

My defence requires equilibrium and balance to be put up.
this is my script
#trigger {All your reflections wink out of existence}
#if (@balance and @equilibrium) {cast reflection on me}

I do have triggers to that set balance and equilibrium off, but as soon as the mud recognises "All your reflections wink out of existence" it tries to cast reflection on me.

i want it to wait until i have balance and equilibruim as soon as that is true it must cast reflection on me

Any help appreciated
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Tue Feb 15, 2005 3:12 am   
 
If you set the variables for balance and equilibrium to "Off" the if statement will be evaluated as true. For it to be false, it needs to evaluate to 0 or null.

#TRIGGER {All your reflections wink out of existence} {#IF ((@balance) AND (@equilibrium)) {cast reflection on me} {#ADDI spellstocast reclection}}

Make one of the above for each weave you want auto-cast.
Then:

#TRIGGER {Text from mud showing that you regain equilibrium} {#IF ((@balance) AND (@equilibrium) AND (@spellstocast)) {cast %item(@spellstocast, 1)}}
#TRIGGER {Text from mud showing that you regain balance} {#IF ((@balance) AND (@equilibrium) AND (@spellstocast)) {cast %item(@spellstocast, 1) on me;#DELN spellstocast 1}}

This is assuming that you can cast only one spell before waiting again for equilibrium and/or balance. If you can cast a bunch of spells in a row without waiting, you can use this instead:

#TRIGGER {Text from mud showing that you regain equilibrium} {#IF ((@balance) AND (@equilibrium) AND (@spellstocast)) {#FORALL @spellstocast {cast %i on me};#VAR spellstocast {}}
#TRIGGER {Text from mud showing that you regain balance} {#IF ((@balance) AND (@equilibrium) AND (@spellstocast)) {#FORALL @spellstocast {cast %i on me};#VAR spellstocast {}}


Then of course if you wanted you could get fancy and make it re-cast if you fail (if you can fail casts in your mud) you could add more, but I'll leave it at this for now.
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
Casius
Novice


Joined: 03 Sep 2004
Posts: 34

PostPosted: Tue Feb 15, 2005 3:35 am   
 
okay let me se if i have got this right.

So in english this is what is happening, If balance and equilibrium is 1 or true i cast reflection on me, but if it is false it adds the cast reflection on me to a list of spells to cast. (to do list) [#addi spellstocast reflection, the word reflection here is an alias for cast reflection on me right?]

Then i regain equilibrium and if balance, equilibrium and spellstocast is true then i will cast reflection on me.

then i regain balance and if balance, equilibrium and spellstocast is = 1 or true, it will cast reflection on me and once its done that it will remove it from list.

should i have the #deln spellstocast at the end of the equilibrium trigger aswell?
#TRIGGER {Text from mud showing that you regain equilibrium} {#IF ((@balance) AND (@equilibrium) AND (@spellstocast)) {cast %item(@spellstocast, 1)on me;#deln spellstocast}}

Another question can you explain the last bit of this trigger to me the part {cast %item(spellstocast, 1)}
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Tue Feb 15, 2005 3:55 am   
 
Hrmm... I think I left a part out of this. Here's my revised version:

#TRIGGER {All your reflections wink out of existence} {#IF ((@balance) AND (@equilibrium)) {cast reflection on me} {#ADDI spellstocast reclection}}


#TRIGGER {Text from mud showing that you regain equilibrium} {#VAR equilibrium {1};#IF ((@balance) AND (@equilibrium) AND (@spellstocast)) {cast %item(@spellstocast, 1)on me;#DELN spellstocast 1}}
#TRIGGER {Text from mud showing that you regain balance} {#VAR balance {1};#IF ((@balance) AND (@equilibrium) AND (@spellstocast)) {cast %item(@spellstocast, 1) on me;#DELN spellstocast 1}}

What this does is, when the spell fails, it will cast it again, IF you have both balance and equilibrium. If not, it will add it to the @spellstocast list. When you receive the text for either equilibrium or balance being regained, it will check to see if both are regained, and if they are, it will attempt to cast the spell and delete it from the list of spells left to cast. It will keep doing this every time you regain equilibrium and/or balance until there are no weaves left that need to be cast.

If there is some sort of text that tells you that you lose equilibrium and/or balance, you'll need to make a trigger like this:

#TRIGGER {Text showing equilibrium lost} {#VAR equilibrium {}}

and then a similar one for balance. If you don't receive text for this, you'll have to find some other way to set balance and equilibrium to {} whenever they go.

The %item(@spellstocast, 1) is the first item on the @spellstocast list. And yes, I did forget the #DELN on the first equilibrium trigger, but it should be #DELN spellstocast 1. Don't forget that 1 on the end, that tells it to delete the first item on the list, which should be the one you just cast. Wink .
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
jptaylor
Newbie


Joined: 14 Feb 2005
Posts: 6

PostPosted: Tue Feb 15, 2005 4:41 am   
 
How about this?
#IF ((@balance = 1) & (@equalibrium=1)) {cast reflection on me}
or
#IF ((@balance = @equalibrium) & (@balance != 0)) {cast reflection on me}

The first if they are just set to yes/no on off.
The second if they are other numbers involved.
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Tue Feb 15, 2005 4:52 am   
 
hrmm... I don't think I see what you're getting at. The IF statements I have work.
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
jptaylor
Newbie


Joined: 14 Feb 2005
Posts: 6

PostPosted: Tue Feb 15, 2005 5:10 am   
 
Ahh. I misread the problem I think.
I didn't know he was looking for a que.
Thought he was having a problem with turning his balance and equalibrium triggers off.
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