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


Joined: 29 Nov 2007
Posts: 3

PostPosted: Thu Nov 29, 2007 10:56 pm   

Stumped on dynamic variable adding.
 
Im trying to trigger off this:

~* You think your (*) skill has improved. ~*

Sometimes the line has a two word skill word where the wild is.. like shield use.

and I have this to compensate for that, and create the variable name and add 1 to it as a counter with this bit.

#ad %replace( %1, " ", "_") 1

Now I just cant figure out how to display that 'value' dynamicly.

under the #add %replace I want it to execute a command that says what skill variable was created dynamically, and the value of THAT specific variable.. but i just cant seem to figure it out.

I've searched.. but no help. Please help?

version is 7x something but im on vista and the help function in zmud itself wont work due to vista incompatibility
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Nov 29, 2007 11:03 pm   
 
Short answer: @{%replace( %1, " ", "_")}

I can't give you a long asnwer without knowing what you really want to do, but hopefully you can figure it out from the short answer.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Nov 29, 2007 11:03 pm   
 
Off the top of my head I think you should be able to do this.

#show %replace( %1, " ", "_") was created dynamically and its value is @{%replace( %1, " ", "_")}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
stumpedjb
Newbie


Joined: 29 Nov 2007
Posts: 3

PostPosted: Thu Nov 29, 2007 11:22 pm   
 
ahh great hint! This is what i have for the value

#var skill %replace( %1, " ", "_")
#ad %replace( %1, " ", "_") 1
ooc @skill imps at @{%replace( %1, " ", "_")}

and it displays:

You say (OOC), 'offensive imps at 2'

*imps stand for improvements, it takes a certain number of improvements to go from say poor to good.

Now another request:

if i type skills i get a list like this:
> skills
show skills
aim blows: Below Average.
attack speed: Below Average.
brawling: Poor.
butchering: A Tyro.
control: Not Very Good.
cooking: Unskilled.
daring: A Beginner.
fighting: Below Average.

How would I replace the second column with the value that I get from the first trigger with the %replace? For instance i would like it to look like this:

> skills
show skills
aim blows: Below Average. +30
attack speed: Below Average. + 10
brawling: Poor. + 5

where the +(number) would be improvement counter or the variable's numeric value thats getting added with the trigger used to create the variable and store the 'imps'
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Nov 29, 2007 11:26 pm   
 
Something like this?

#trig {^([%w ])(: [%w ].)} {#sub {%1%2 %if(@{%replace(%1," ","_")},+ @{%replace(%1," ","_")})}

EDIT: Unlucky, Arminas :P
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)

Last edited by Fang Xianfu on Thu Nov 29, 2007 11:31 pm; edited 1 time in total
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Nov 29, 2007 11:30 pm   
 
Something similar to this.


Code:
#trigger {^({aim blows|attack speed|brawling})(: *.)$} {#var skill %replace( %1, " ", "_");#sub {%concat(@skill, " ", %2, " +", @{@skill})}}


*fingers crossed about being sliced to ribbons again*

Edit :*dies a slow cruel death at Fang's hand*
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
stumpedjb
Newbie


Joined: 29 Nov 2007
Posts: 3

PostPosted: Thu Nov 29, 2007 11:46 pm   
 
second suggestion worked, thanks
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