 |
Shinowa Newbie
Joined: 13 Apr 2007 Posts: 2
|
Posted: Fri Apr 13, 2007 2:06 am
Advanced Prompt Variables |
Ok, so I'm trying to set up a trigger to store various parts of my prompt into variables. I've tried a few different ways, and finally found a way that worked. Here's what I got.
What my prompt looks like
(5800:5800) (3988:3988) (1297:1300) [You] [100%] | [100%]
hp max mana max move max tank <- health target's health
This is what my trigger pattern looks like
~(&hp~:%d~) ~(&mana~:%d~) ~(&move~:%d~) ~[&tank~] ~[&tankhp~%~] ~| ~[&targethp~%~]
(I tried going the (%n:%d) (%n:%d) ect route, but it wasn't working anyways)
My value's look like this
#VAR hp %1
#VAR mana %3
#VAR move %5
#VAR tank %7
#VAR tankhp %8
#VAR targethp %9
I have it triggering on prompt, and have it set to case sensitive, so it only triggers on my fprompt, cause my regular prompt is similar.
Everything works perfectly, the only problem I'm having is that it is echoing variable changes after my prompt .. here's what I'm seeing
(5800:5800) (3988:3988) (1298:1300) [You] [100%] | [100%]Variable: tank You
Variable: tankhp 100
Variable: targethp 100
So how can I make it stop echoing the variables? .. |
|
|
 |
Shinowa Newbie
Joined: 13 Apr 2007 Posts: 2
|
Posted: Fri Apr 13, 2007 3:16 am |
I figured it out .. for some reason i guess it's not considering the %d's as %2, %4, and %6.
I changed the value's to
#VAR hp %1
#VAR mana %2
#VAR move %3
#VAR tank %4
#VAR tankhp %5
#VAR targethp %6
and it doesn't echo any more, and seems to work perfectly. |
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Apr 13, 2007 12:10 pm |
You're mixing up all your syntax for the pattern to capture the prompt stats. Something like this may work better:
Code: |
#TRIGGER {~((%d)~:%d~) ~((%d)~:%d~) ~((%d)~:%d~) ~[(%w)~] ~[(%d)~%~] ~| ~[(%d)~%~]} {
#VAR hp %1
#VAR mana %2
#VAR move %3
#VAR tank %4
#VAR tankhp %5
#VAR targethp %6
} |
If you want to capture directly to the variables, you still need to use the wildcard (for example, %d to capture a number into hp) with the variable name. In that case, you don't need the #VAR commands, either. That version might look like this:
Code: |
#TRIGGER {~(&%dhp~:%d~) ~(&%dmana~:%d~) ~(&%dmove~:%d~) ~[&%wtank~] ~[&%dtankhp~%~] ~| ~[&%dtargethp~%~]} {} |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Apr 13, 2007 1:42 pm |
Incidentally, there is no (%n:%d) syntax - there's a similar ($localvar:wildcard) syntax in CMUD, but you don't need the %n or the colon in CMUD. As long as they're bracketed they're automatically given a %n variable, as you can see in Larkin's example.
|
|
|
 |
|
|