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


Joined: 22 Oct 2006
Posts: 2

PostPosted: Sun Oct 22, 2006 8:29 pm   

Trigger with #IF and #ADD problem
 
I am using Zmud for FederationII. I am attempting to use a trigger to detect my current stockpile of a commodity and if the stockpile is full issue a command to bump the maximum allowable stockpile up.

Here is what the MUD shows:

Cereals: value 245ig/ton Spread: 15% Stock: current 685/min 100/max 1100 Efficiency: 113%


Here is what I have so far:

#trigger {Cereals: value * Spread: * Stock: current &%dcurrent/*/max &%dmax} {
#if @current=@max
#add max 50
set cereals max @max
}

I have this in the value box in the editor and Cereals in the pattern box.
This will detect the current and max settings, put them into a variable correctly, but always adds 50 to my max stockpile rather than only when max=current. I also tried adding a 'false' command with something like Say Cereals are not full now. The false is not necessary, but only want the command to increase maximum stockpile if current=max. I have yet been unable to determine whether I am using the #IF command #ADD commands properly or if my syntax is just wrong or if those are the right commands to use. Any help would be appreciated.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Oct 22, 2006 9:03 pm   
 
Your problem is the #IF syntax. You basically have a test condition but no code to run for either a true or false result, and the other two commands are treated as separate from the #IF they are supposed to be contained in.

Two changes to use proper syntax:
1)parentheses around the condition -- (@current = @max)
2)curly braces around the commands for the true condition code and the false condition code (if there are no commands for the latter, the braces are not necessary) -- {#add max 50;set cereals max @max}
_________________
EDIT: I didn't like my old signature
Reply with quote
Stirling
Newbie


Joined: 22 Oct 2006
Posts: 2

PostPosted: Sun Oct 22, 2006 10:51 pm   
 
Thank you for the quick reply. I made the changes you suggested. Those were used in the past, but did them again for good measure. With those changes made, the editor indicates a syntax error with the curly bracket before the #ADD syntax. Here is what the script looks like with your suggested changes (in case I did not apply your suggestions properly).

#trigger {Cereals: value * Spread: * Stock: current &%dcurrent/*/max &%dmax} {
#if (@current=@max){#add max 50
set cereals max @max}{Say Cereals are not full.}
}

Once again this is in the 'Value' box inside the editor and Cereals is in the Pattern box.

Thanks again.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Oct 22, 2006 11:46 pm   
 
Missing some spaces where there should be spaces

#trigger {Cereals: value * Spread: * Stock: current &%dcurrent/*/max &%dmax} {
#if (@current=@max) {
#add max 50
set cereals max @max
} {Say Cereals are not full.}
}
_________________
Zmud Support Library
Zmud Knowledge Base
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