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
Qyrios
Beginner


Joined: 04 Apr 2009
Posts: 11

PostPosted: Thu Apr 30, 2009 6:12 pm   

Triggers not working.
 
Hello,

I'm using the following script:
Code:

#TRIGGER {*Qyrios*~(*(%w)~)}
#COND {You are level (%d) ~(*~) and (%d)~% of the way to the next level.} {
  #VAR level %1
  #VAR percent %2
  } {within|param=1}
#COND {Health:%s(%d)%s/%s(%d)%sMana:%s(%d)%s/%s(%d)%s} {
  #VAR curHealth %1
  #VAR maxHealth %2
  #VAR curMana %3
  #VAR maxMana %4
  } {within|param=1}
#COND {Endurance:%s(%d)%d/%d(%d)%sWillpower:%s(%d)%s/%s(%d)%s}{
  #VAR curEndurance %1
  #VAR maxEndurance %2
  #VAR curWillpower %3
  #VAR maxWillpower %4
  }


When you do QSC in Achaea you will see a quick score which includes level, health, mana etc. The above script is supposed to put those things into variables.

Doing QSC looks like this:

Code:

Forestwalker Qyrios (male Satyr)
You are level 10 (Nice) and 27% of the way to the next level.
Health:       1000 / 1000     Mana:         800 / 800
Endurance:   7000 /7000     Willpower:   5000 /5000
Strength: 13  Dexterity: 13  Constitution: 13  Intelligence: 10


However, the variables are not loaded. I've been looking at this tutorial.

Could someone help me troubleshoot?

Thank you.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Thu Apr 30, 2009 7:01 pm   
 
{Endurance:%s(%d)%s/%s(%d)%sWillpower:%s(%d)%s/%s(%d)%s}
_________________
Discord: Shalimarwildcat
Reply with quote
Qyrios
Beginner


Joined: 04 Apr 2009
Posts: 11

PostPosted: Thu Apr 30, 2009 7:11 pm   
 
What is wrong with that?
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Thu Apr 30, 2009 7:50 pm   
 
There is no space between the slash and max value, same for willpower...However health does have it and is a 4 digit number, bad number padding.
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Qyrios
Beginner


Joined: 04 Apr 2009
Posts: 11

PostPosted: Thu Apr 30, 2009 7:57 pm   
 
I changed it to:
Code:

#COND {You are level (%d) ~(*~) and (%d)~% of the way to the next level.} {
  #VAR level %1
  #VAR percent %2
  } {within|param=1}
#COND {Health:%s(%d)*/*(%d)%sMana:%s(%d)*/*(%d)%s} {
  #VAR curHealth %1
  #VAR maxHealth %2
  #VAR curMana %3
  #VAR maxMana %4
  } {within|param=1}
#COND {Endurance:%s(%d)*/*(%d)%sWillpower:%s(%d)*/*(%d)%s}{
  #VAR curEndurance %1
  #VAR maxEndurance %2
  #VAR curWillpower %3
  #VAR maxWillpower %4
  }


Only now I'm getting parse errors.

The padding is filled up when your stats get bigger.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Thu Apr 30, 2009 8:02 pm   
 
you could use ([%s%d]) and then %trim(%1) the parameters
_________________
Discord: Shalimarwildcat
Reply with quote
Qyrios
Beginner


Joined: 04 Apr 2009
Posts: 11

PostPosted: Fri May 01, 2009 9:53 am   
 
I tried that, it doesn't give parsing errors, but it doesn't seem to work either. What could I try next?
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Fri May 01, 2009 4:17 pm   
 
OH OH Oh, typo tfl, <3 the cmud syntax highlighter.

Code:
#TRIGGER {*Qyrios*~(*(%w)~)}
#COND {^You are level (%d) ~(*~) and (%d)~% of the way to the next level.$} {
  #VAR level %1
  #VAR percent %2
  } {within|param=1}
#COND {^Health:%s(%d)*/*(%d)%sMana:%s(%d)*/*(%d)%s} {
  #VAR curHealth %1
  #VAR maxHealth %2
  #VAR curMana %3
  #VAR maxMana %4
  } {within|param=1}
#COND {^Endurance:%s(%d)*/*(%d)%sWillpower:%s(%d)*/*(%d)%s} {
  #VAR curEndurance %1
  #VAR maxEndurance %2
  #VAR curWillpower %3
  #VAR maxWillpower %4
  } {within|param=1}


From your last code post, the only IMPORTANT change is a space on the 3rd condition, space between the pattern and the script, and the original trigger.

Besides that, I added line anchors, will help trigger matching speed, and accuracy, not that it should give you false positives, but a good habit to get into, and the within 1 line param to last condition.
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Qyrios
Beginner


Joined: 04 Apr 2009
Posts: 11

PostPosted: Fri May 01, 2009 4:50 pm   
 
It works a bit better now. When I type QSC it will read 'r' into level, and it will output Variable: percent.

Like so:
Code:

Forestwalker Qyrios (male Satyr)
You are level 12 (Good) and 34% of the way to the next level.
Variable: percent             
Health:       1000 / 1000     Mana:         1000 / 1000
Endurance:   1000 /1000     Willpower:   1000 /1000
Strength: 13  Dexterity: 13  Constitution: 13  Intelligence: 10


However, it doesn't work yet.

And what exactly is the function of '$' in the above code?


Last edited by Qyrios on Fri May 01, 2009 5:06 pm; edited 1 time in total
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Fri May 01, 2009 5:04 pm   
 
^ is a beginning line anchor $ is end of line anchor.
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Qyrios
Beginner


Joined: 04 Apr 2009
Posts: 11

PostPosted: Tue May 05, 2009 3:28 pm   
 
Since I have tried quite some things, but still can't get it to work I have decided to start with something simple:
Code:

#CLASS {test}
#VAR testvar {0} {0}
#TRIGGER {} {}
#TRIGGER {Forestwalker Qyrios (male Satyr)} {#VAR testvar 1}
#CLASS 0


This doesn't work either, it's supposed just to change the value of testvar from 0 into 1 when the line "Forestwalker Qyrios (male Satyr)" appears on the screen.

What's the problem?
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Tue May 05, 2009 4:06 pm   
 
You need to escape the parentheses, zmud is seeing those as a capture. It's been long time since i've used zmud, but i'ld also remove the first empty trigger, not sure what it's purpose is, try:

Code:
#CLASS {test}
#VAR testvar {0} {0}
#TRIGGER {^Forestwalker Qyrios ~(male Satyr~)$} {#VAR testvar 1;#show {testvar is now: @testvar}}
#CLASS 0
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Qyrios
Beginner


Joined: 04 Apr 2009
Posts: 11

PostPosted: Wed May 06, 2009 1:48 pm   
 
I have now tried the following, it looks like this:



Only when I rightclick, and export it I see this:
Code:

#CLASS {test}
#VAR testvar {0} {0}
#TRIGGER {Forestwalker Qyrios (male Satyr)} {#VAR testvar 1}
#CLASS 0


What's going on?
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