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
Ruderion
Novice


Joined: 12 Jan 2003
Posts: 33
Location: Netherlands

PostPosted: Wed Oct 06, 2004 6:18 pm   

#math creating classes
 
I have a trigger set up to count the number of improvements on my skills.
Like this

#TR {You have become better at (*)!} {#math %1 @%1+1}

It works fine for skills like brew and scribe but when i improve at a skill with 2 words like enhanced damage and fast healing things go wrong. A new class is created named '@enhanced' with a variable in it named '@enhanced' and a value of 'damage'.
How do i prevent something like this to happen without setting up a special trigger for every skill?
_________________
Ruderion
Reply with quote
Bowie
Newbie


Joined: 06 Oct 2004
Posts: 1

PostPosted: Wed Oct 06, 2004 8:02 pm   
 
Hmm...Can think of two ways:

1.) #TR {You have become better at (*)!} {#VAR SkillName %replace("%1"," ","");#MATH @SkillName (@{@SkillName}+1)

2. #TR {You have become better at (*)!} {#MATH {%1}...not sure how to finish this one, I tried a few ways and cant get a multiword variable to work in the #MATH command.

1 just uses a new variable which strips the spaces from the name, 2 /should/ be able to make multiword variables work...some how. Hope this helps.
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Wed Oct 06, 2004 8:06 pm   
 
You need to keep it simple.

#TRIGGER {You have become better at (*)!} {
skillname = %replace( %1, " ", "_")
#addkey skills @skillname [%db( @skills, @skillname) + 1]
}

The above trigger stores the data in a variable record. As you see it replaces whitespace with an underscore.
Reply with quote
Ruderion
Novice


Joined: 12 Jan 2003
Posts: 33
Location: Netherlands

PostPosted: Wed Oct 06, 2004 8:50 pm   
 
of course. Should have thought about that myself. And with that database variable it is a lot easier to keep track of all the values. Thanks!
_________________
Ruderion
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