 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Nov 26, 2006 10:04 pm
[1.16] #PSUB color/placement bug |
Using #PSUB's in a trigger generates messed up output whenever text other than what you are triggering on is received from the mud
Note this trigger is 100% functional in zmud (except for the added in local vars). This is also the only trigger in the current cmud session.
Trigger Pattern:
| Code: |
| ^~[(%x) (*)] HP:(%d)/(%d) (%d)~% MA:(%d)/(%d) (%d)~% MV:(%d)/(%d) (%d)~% Pos:(%x) (*)> |
Trigger Script with prompt checked newline unchecked:
| Code: |
#ADDKEY Prompt Name {%1}
#ADDKEY Prompt Time {%trim(%2)}
$hpc=(%[email protected])
#ADDKEY Prompt Hp {%3}
#ADDKEY Prompt MaxHp {%4}
#ADDKEY Prompt PerHp {%5}
$mac=(%[email protected])
#ADDKEY Prompt Ma {%6}
#ADDKEY Prompt MaxMa {%7}
#ADDKEY Prompt PerMa {%8}
$mvc=(%[email protected])
#ADDKEY Prompt Mv {%9}
#ADDKEY Prompt MaxMv {%10}
#ADDKEY Prompt PerMv {%11}
#ADDKEY Prompt Position {%12}
#ADDKEY Prompt Fighting {%if(%pos("fighting",%lower(%13)),"True","False")}
#ADDKEY Prompt Afk {%if(%pos("afk",%lower(%13)),"True","False")}
#PSUB {%4/0} (%word(%x4,1)) (%word(%x5,2)+1)
#PSUB {%7/0} (%word(%x7,1)) (%word(%x8,2)+1)
#PSUB {%10/0} (%word(%x10,1)) (%word(%x11,2)+1)
|
Psub Desc:
Add in the hpc mac and mvc (just a differance between prompts) psub not complete pending local var expansion problem posted about earlier. for now just using "0" instead of "$hpc" etc...
StartX and EndX: Uses the StartX of Maxhp(%x4) and the EndX of PerHp(%x5) to replace everything between max and percent and the percent sign.
Output before trigger (what it triggers on):
| Code: |
| [Axis 1:07 pm] HP:643/643 100% MA:320/320 100% MV:585/585 100% Pos:Standing AFK > |
Output after trigger (everything #psub'ed correctly, but if I hold down the "enter key" it starts changing but not as much as the next example):
| Code: |
| [Axis 4:18 pm] HP:643/643/0 MA:320/320/0 MV:585/585/0 Pos:Standing AFK > |
Output changes after receiving lines from the mud: including adding and changing of colors and other horrid things including placing in the wrong spot
 |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Nov 27, 2006 7:03 am |
One quick thing: The multiple-localvars-in-triggers bug is fixed now (<3 Zugg) so you can get rid of that horrid %nn syntax entirely with ($param:%wildcard) if you like.
|
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Nov 27, 2006 11:55 pm |
I do weird things with my prompt :p
I store all the data in the PROMPT data record. The three local vars are used for the difference between my last stored prompt and the current prompt. so there is no reliable way to capture it from the trigger pattern line.
$hpc=(%[email protected]) //Subtract the value of @Prompt.Hp (stored from last prompt) from %3 (the current hp)
#ADDKEY Prompt Hp {%3} //Now that we have the difference we can store %3 into Prompt.Hp |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Nov 28, 2006 7:07 am |
Oh, I know that. I just mean that you can replace the other %nns with localvars if you want to make it more readable. I only found out that bug was fixed when I looked at this thread and checked to see if that's why you hadn't updated the script :P
|
|
|
|
 |
|
|
|