|
AtmaWeapon Newbie
Joined: 07 Apr 2003 Posts: 9 Location: USA
|
Posted: Tue Dec 13, 2005 4:40 am
Newbie conditional trigger help |
I'm trying to write a trigger that updates variables to keep track of my per-fight and per-session xp gain in a MUD, but I'm having a hard time figuring out how to do so.
What works is the trigger that updates a variable fightOver that indicates if I am still in a fight or not. My plan is to have a trigger that catches any xp gain message and:- If fightOver is true, set it to false and set xpGainFight to 0
- In any case, increment xpGainSession and xpGainFight by the amount of xp gained
I tried using an #if but determined the trigger was sending my statements to the MUD as commands, which is not what I wanted.
How do I pull off this simple feat? |
|
|
|
AtmaWeapon Newbie
Joined: 07 Apr 2003 Posts: 9 Location: USA
|
Posted: Wed Dec 14, 2005 3:28 am |
No one wants to help? :(
|
|
|
|
Slaem Apprentice
Joined: 20 Sep 2005 Posts: 135
|
Posted: Wed Dec 14, 2005 6:15 am |
Can you post what you have so far and maybe some examples of your xp messages?
|
|
|
|
AtmaWeapon Newbie
Joined: 07 Apr 2003 Posts: 9 Location: USA
|
Posted: Thu Dec 15, 2005 2:46 am |
Ok.
First I have a trigger that responds to:
Gohan gives you one gold coin for your sacrifice.
This indicates a fight is over and sets the variable fightOver to true.
Next I have a trigger that responds to:
Your experience increases by (%d).
This indicates some rise in experience and is assumed to be the beginning of a fight. Here is what I tried (formatted as Zmud did it:
Code: |
#if (@fightOver) {
fightOver = false
expGainedSession = 0
} {expGained = %eval( %int( @expGained) + %int( %1))
expGainedSession = %eval( %int( @expGainedSession) + %int( %1))} |
What ends up happening is when the "Your experience..." message is caught, the script statements are sent to the MUD as text. I'm assuming something is seriously wrong since the statements are indented so strangely. How can I make the statements execute like I want them to? |
|
|
|
Pseudo Wanderer
Joined: 25 Oct 2005 Posts: 99
|
Posted: Thu Dec 15, 2005 1:13 pm |
#ACTION {Your experience increases by (%d)} {
#IF (@fightover=true) {
#var fightOver 0
#var expGainedSession 0
} {
#var expGained %eval(%int(@expGained) + %int(%1))
#var expGainedSession %eval(%int(@expGainedSession)+%int(%1))
}
} |
|
|
|
AtmaWeapon Newbie
Joined: 07 Apr 2003 Posts: 9 Location: USA
|
Posted: Fri Dec 16, 2005 3:28 am |
That still seems to have the same effect; the lines within and including the {}s are sent to the MUD as text.
However I do admit I am doing this through the trigger editor and not using the direct #ACTION command; where do I put those so I can give them a shot? |
|
|
|
Slaem Apprentice
Joined: 20 Sep 2005 Posts: 135
|
Posted: Fri Dec 16, 2005 4:33 am |
Copy and paste the entire script into the command line and press Enter.
It sounds like you're missing a bracket somewhere, but I don't see anything missing in your posted code. I copied your original scirpt in like this:
Code: |
#TR {Your experience increases by (%d)} {#if (@fightOver) {
fightOver = false
expGainedSession = 0
} {expGained = %eval( %int( @expGained) + %int( %1))
expGainedSession = %eval( %int( @expGainedSession) + %int( %1))}} |
without changing the spacing, and it worked fine. Pseudo's works too. You probably left off a closing bracket in the editor. |
|
|
|
Pseudo Wanderer
Joined: 25 Oct 2005 Posts: 99
|
Posted: Fri Dec 16, 2005 5:10 pm |
I thought I should add that when i copy and paste my posted code into the setting editor or use it from the command line, zmud continues to remove the @fightover variable and the entire script registers an error. I would suggest checking the code when you paste it.
|
|
|
|
AtmaWeapon Newbie
Joined: 07 Apr 2003 Posts: 9 Location: USA
|
Posted: Mon Dec 19, 2005 3:19 pm |
Pasting Pseudo's code worked great; I assume I had some kind of tough-to-find syntax error in my original code.
Thanks for the help guys! |
|
|
|
|
|