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


Joined: 07 Apr 2003
Posts: 9
Location: USA

PostPosted: 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?
Reply with quote
AtmaWeapon
Newbie


Joined: 07 Apr 2003
Posts: 9
Location: USA

PostPosted: Wed Dec 14, 2005 3:28 am   
 
No one wants to help? :(
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Wed Dec 14, 2005 6:15 am   
 
Can you post what you have so far and maybe some examples of your xp messages?
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
AtmaWeapon
Newbie


Joined: 07 Apr 2003
Posts: 9
Location: USA

PostPosted: 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?
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: 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))
}
}
Reply with quote
AtmaWeapon
Newbie


Joined: 07 Apr 2003
Posts: 9
Location: USA

PostPosted: 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?
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: 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.
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: 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.
Reply with quote
AtmaWeapon
Newbie


Joined: 07 Apr 2003
Posts: 9
Location: USA

PostPosted: 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!
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