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
zema
Wanderer


Joined: 22 Jun 2005
Posts: 79

PostPosted: Sat Jun 25, 2005 6:19 pm   

question
 
I am not quite shure i am understanding this right i have read through the "getting started" part of the helpfile, and quite a bit on scripting i now understand what all the special chars do however i am still kinda in the dark about {^hp: (%d) mp: (%d) {%1 = @hp;%2 = @mp} "" "prompt"
the %d %1 ect are supposed to signafy like know this is a basic hp prompt and zmud is reading the %d and %1 as the proper variables. but it's just not clicking on how else i can use them could someone post a simple scriping example please? Also i have looked though alot of the exsisting scrips they seem to be too complicated for me to understand
_________________
There are 3 things i hate kids, animals, and women with attitudes..
Reply with quote
demoneyoungblood
Apprentice


Joined: 16 Dec 2002
Posts: 114
Location: USA

PostPosted: Sat Jun 25, 2005 9:05 pm   
 
ok.. ^ is the "beginning of line" character
%d refers to any number of Digits (0-9)
%1 refers to the first grouped item in the trigger..., %2 refers to the second cluster...

so... lets break it down a bit

#trigger {^hp: (%d) mp: (%d)} {%1=@hp;%2=@mp}"" "prompt"

means that its looking for text like the following from a mud

blahblbha lbah
hp: 100 mp: 200

notice that there was no space before hp? thats what the ^ looks for... this way if someone tries to do an emote, resulting in something like:

character hp: 100 mp: 250

it will not fire..

Now, the (%d), notice that there are ( ) around them, this is how you capture a group... so that you can use a backreference, like the %1 and %2

the hp: (%d) is the first backreference (the %d part anyway)
and the mana %d is the second backreference

so when you execute the trigger, it sets
%1 (or your value for hp, in my example case 100)
to the value of the variable hp
so now, we have our first variable
and the %2=@mp does the same, it sets the variable "mp" to the second backreference, or in the examples case, 250.

If you would like some help, go ahead and message me on aim, wrastinusrhaewyr is the name im on right now.
_________________
-Demone YoungBlood
Reply with quote
zema
Wanderer


Joined: 22 Jun 2005
Posts: 79

PostPosted: Sun Jun 26, 2005 5:10 am   
 
Would zmud always backrefrence %1 to be connected to the variable @hp like could i only use %1 if i was refering it my hpvariable or could i use it over in another script?
_________________
There are 3 things i hate kids, animals, and women with attitudes..
Reply with quote
Kiasyn
Apprentice


Joined: 05 Dec 2004
Posts: 196
Location: New Zealand

PostPosted: Sun Jun 26, 2005 7:02 am   
 
no
_________________
Kiasyn
Owner of Legends of Drazon
Coder on Dark Legacy
Check out Talon, an easy IMC connection.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Jun 26, 2005 8:44 am   
 
The %1 refers to the position of the variable defining function (if that makes sense) in the trigger. In the example above, the %1 means to set whatever is at the first (%d) to hp, and the %2 means whatever is at the second (%d) is set to mp. If you were to have another (%d) in the pattern, you'd have %3, and so forth.

zMUD never backreferences, so to speak. Each trigger acts on its own accord, dependant upon the user input. The special wildcard characters are just that - wild cards. And the position reference characters are, again, just that - position reference characters. I hope this has helped explain things a little better. Check out the section in zMUD help for special characters and predefined variables.

Charneus
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Sun Jun 26, 2005 6:24 pm   
 
{%1 = @hp;%2 = @mp} ???

Where did this example come from?

Does that even work, assigning a variable's value to a predefined variable?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jun 26, 2005 6:36 pm   
 
It will work I think just the results will not be what you want :p

I think this is what you are looking for

hp=%1;mp=%2
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
zema
Wanderer


Joined: 22 Jun 2005
Posts: 79

PostPosted: Sun Jun 26, 2005 10:38 pm   
 
it's my prompt for my gauges and it works FINE thank you =p I understand now it's basically just a placeholder :)..see i am getting it lil by lil it's clicking thanks for the help as usual
_________________
There are 3 things i hate kids, animals, and women with attitudes..
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