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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Dryeck
Beginner


Joined: 19 Feb 2010
Posts: 13

PostPosted: Sat Feb 20, 2010 1:48 am   

Problems with #IF
 
Ok really sorry about 3 posts in a row but I thought that if I have a new question I should have an appropriate title. This will be my last post (for the day : ]). This has been a problem for awhile. #IF continuously does not work for me. Instead of doing the appropriate action depending on which #IF condition is satisfied, it does everything in the trigger. Here is today's example:

Trigger line: $A salve of mending sloshes about in it.$

Script:
#IF (@./Elixirs/Mending = 0) {./Elixirs/Mending = 1}
#IF (@./Elixirs/Mending = 1) {./Elixirs/Mending = 2}
#IF (@./Elixirs/Mending = 2) {./Elixirs/Mending = 3}
#IF (@./Elixirs/Mending = 3) {./Elixirs/Mending = 4}
#IF (@./Elixirs/Mending = 4) {./Elixirs/Mending = 5}

What it should be doing is when it sees mending in a vial, it will raise the number to 1 if it was previously 0, 2 if it was previously 1, etc. What it IS doing is just setting the variable to 5 (With what I'm doing it should only go to 3). Obviously I'm guessing that #IF works fine and I am doing something stupid.

For the curious I am trying to make a kind of Elixlist for people without it.

Tl;dr: What am I doing wrong with #IF?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Feb 20, 2010 2:04 am   
 
Because each line is firing, thus making it true for all statements. Each line in an alias/trigger/whatever is processed individually, with updated results.

Why are you not using something simple, like:

#IF (@./Elixirs/Mending>5) {#ADD @./Elixirs/Mending 1}

?

Charneus
Reply with quote
Dryeck
Beginner


Joined: 19 Feb 2010
Posts: 13

PostPosted: Sat Feb 20, 2010 2:17 am   
 
That did nothing to the variable. I think you misunderstand what I am trying to do. For example:

I have 3 mending vials in my inventory and no other vials. I probe one and get the A salve of mending sloshes about in it. line. Previously the /Elixirs/Mending variable was 0. Now I want it to be 1. If I probe another mending (or the same one) I want the variable to go from 1 to 2. Etc.
Reply with quote
kingfish1
Beginner


Joined: 13 Jun 2005
Posts: 20

PostPosted: Sat Feb 20, 2010 2:28 am   
 
Use the ADD without the @ something like:

Trigger line: $A salve of mending sloshes about in it.$

#ADD ./Elixirs/Mending 1
Reply with quote
Dryeck
Beginner


Joined: 19 Feb 2010
Posts: 13

PostPosted: Sat Feb 20, 2010 2:32 am   
 
Ahah, that worked, thanks!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Feb 20, 2010 3:59 am   
 
For what it's worth, I knew exactly what you were doing, which is why I suggested my way. :P I just made the mistake of adding the @ sign in the #ADD command. :P Oh well.

Charneus
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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