Trigger problem

Posted by Dabura on Mon 14 Feb 2005 09:39 PM — 3 posts, 13,567 views.

#0
I was playing Achaea the other day, and I have a trigger to set my health and mana to variables. The match is:
^(.*?)h\, (.*?)m

and then it sends world.setvariable "health", %1, world.setvariable "mana", %2.
For some reason, when I was playing, I got an error from it trying to send
world.setvariable "health", in tight red leather. Lying in a gelatinous mass of dead flesh, the small fishboy has been filleted.
to script. Any ideas why it would match that?
All I did to get that match, by the way, was Convert to regexp, and then I deleted the anchor at the end because my prompt doesn't end there.
USA #1
You probably got that because your prompt got tacked onto the end of a line, so the whole first variable is that line.

You can fix it by making it match on only digits:
(\d+)h\, (\d+)m
and that also removes the start of line anchor, which you probably want to do (so when this happens again, and your prompt is after some stuff, you still match) or you can leave it, and just not have it update in those cases.

And you should quote your variables as well:
world.setvariable "health", "%1"
that was ultimately the source of your problem, since otherwise it wouldnt have yelled at you, just set the variable to a string.
Amended on Mon 14 Feb 2005 09:46 PM by Flannel
#2
Thanks.