|
CherubOfTheNight Newbie
Joined: 04 Jul 2008 Posts: 1
|
Posted: Fri Jul 04, 2008 1:24 am
Variable Evaluation |
Alright, I'm genuinely trying to figure this out on the switch between zMUD and CMUD, but really this is just killing me currently. If there's a help file that someone could point me to that explains better how CMUD evaluates expressions I'd be greatly appreciative, until then though, it's a question by agonizing question basis.
For reference, I'm an Imperian player, skill there called Vodun that essentially deals with Vodun dolls.
Quote: |
"doll295094" a living vodun doll of Valena
|
Now, what I used to essentially do was,
Code: |
#REGEX {^\"doll\d+\"(?:.+)a living vodun doll of \w+$} {
#class {Dollnumbers}
#var "doll"+%2
#class 0
}
|
And with that I would basically be able to create a system to store a bunch of different explicit numbers based off of the names associated with the dolls, but apparently CMUD handles variable storage from the expressions differently because all I'm currently receiving out of this is...
I'm having essentially the same program with an internal name coloration system I had in order to keep track of combatants and which sides they fought for,
Code: |
#ALIAS {dmark} {
#class {Marked}
#trigger {%1} {#cw {azure,crimson,bold}}
#class 0
}
|
Usage: dmark Valena
Where it would create the individual trigger
Code: |
#TRIGGER {Valena} {#cw {azure,crimson,bold}}
|
And instead all I receive now is
Code: |
#TRIGGER {%1} {#cw {azure,crimson,bold}}
If someone could just explain to me how the evaluation system of this has all changed and maybe point me in the right direction for fixing this, I'd be immensely appreciative. |
|
|
|
|
Nicodareus Wanderer
Joined: 24 Jun 2008 Posts: 68 Location: Texas
|
Posted: Fri Jul 04, 2008 1:29 am |
I believe that the brackets around the %1 in your latter problem is what's giving you issues. I've not dealt heavily with scripts in CMud yet, but I'm pretty sure that's one of the changes detailed in the ZMud->Cmud migration guide which you might want to take a look over. The brackets in this case are basically telling the data not to be parsed as an expression, but to be sent verbatim to the client. Hence why you just get {%1} in your trigger.
|
|
|
|
Nicodareus Wanderer
Joined: 24 Jun 2008 Posts: 68 Location: Texas
|
Posted: Fri Jul 04, 2008 1:40 am |
Code: |
#ALIAS {dmark} {
#class {Marked}
#trigger "" %1 {#cw {azure,crimson,bold}}
#class 0
} |
Seems to do what you are looking for here, but I'm not going to tell you it's the best way to do it. All I know is it seems to work properly.
Edit: You could optionally replace the "" above with something like: "Mark" and your triggers that are created would be labeled as "Mark: <name>" but still only parse on <name>. A bit of sorting simplicity if nothing else.
2nd edit: After reading through the help file for #alias, a better method of this would be:
Code: |
#ALIAS dmark($target) {
#class {Marked}
#trigger "" $target {#cw {azure,crimson,bold}}
#class 0
} |
as it lets you better control what does what instead of trying to keep track of what %1, %2, %3, etc is all about. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Jul 04, 2008 10:46 am |
I don't see anything being captured in your original regex, which is likely the reason you are not getting the result you want. I would also suggest using a record variable.
Code: |
#REGEX {^"(doll\d+)"\s+a living vodun doll of (\w+)$} {
#ADDKEY DollNumbers {%1} {%2}
#ADDKEY DollNumbers {%2} {%1}
} |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Jul 04, 2008 1:16 pm |
edit: Scratch that.
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|
|
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
|
|