|
knagi Newbie
Joined: 16 Mar 2004 Posts: 3 Location: USA
|
Posted: Tue Mar 16, 2004 5:52 pm
Script from Hell, Multi Line, Multi Capture. HELP! |
Group Leader: [Knagi]
+Rnk-Lvl-Rmt+ --Name-- +Hps%-Mvs%+ --=- Gjob -=-- =-Exp2Lvl-=
1.[2- 63-4 ] Knagi 100 100 '.Chloroform Rapist' (14644758)
[2- 56-4 ] Simkin 100 100 '..healyoursorryass' (11968069)
Group PK-Index : [38]
Group Members : [2]
This is the standard return for the Mud I play right now. Groups can be up to ten in size this is only a group of two but should suffice for idea forming. As it is right now the mud has a command that the leader of the group can sent everyone into order and mark them 1. 2. 3. and so on appear in front of thier names.. At that point it's simple. However the problem comes when groups are always changing and the Leader doesn't always take the time to put everyone into order.
The end result when the orders are set is that I capture info from the lines such as name,hp,and mv. Then return it as a guage button on the top of my screen making tracking large groups current stats during massive battles quite simple.
Does anyone have a clue how I could capture this info without the orders being set? 1. for the leader is always constant. the current working capture for the leader is 1.~[*~]%s(%w)%s(%d)%s(%d) which works great.... %1 returns the name %2 returns hp %3 returns mv. But what happens when 1. is removed and all lines id the same for 10 people? How do you split it up? |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Tue Mar 16, 2004 6:55 pm |
If some have numbers in front, and some don't, just remove the number from the pattern entirely:
Pattern: ~[*~]%s(%w)%s(%d)%s(%d) |
|
|
|
knagi Newbie
Joined: 16 Mar 2004 Posts: 3 Location: USA
|
Posted: Tue Mar 16, 2004 7:04 pm |
that would be nice and easy way... however that set-up will only capture the last name on the list. I need some way to swap varables as it goes. So it writes one then moves to the next. If I could stack varables this would be simple. Set one varable to count and then a set to store the info @count@group... But #var @count/group %1 doesn't work. Like 1group 2group 3group and so on.
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Mar 16, 2004 9:04 pm |
I'd use two triggers along with a list-variable and two record-variables. The first trigger can look for the 1. and clear the variables, the second trigger can ignore the numbers and add an entry to each variable for each person.
#TR {1.*~]%s(%w)%s(%d)%s(%d)} {#VAR GroupNames %null;#VAR GroupHP %null;#VAR GroupMV %null;#ADDITEM GroupNames %1;#ADDKEY GroupHP %1 %2;#ADDKEY GroupMV %1 %3}
#TR {~]%s(%w)%s(%d)%s(%d)} {#IF (!%iskey( @GroupNames, %1)) {#ADDI GroupNames %1;#ADDK GroupHP %1 %2;#ADDK GroupMV %1 %3}
This should create three variables that all have names in the same order. You can then find the hp's and mv's for any spot in the order using %db and %item. For instance the third person's hp's would be:
%db( @GroupHP, %item( @GroupNames, 3)) |
|
|
|
knagi Newbie
Joined: 16 Mar 2004 Posts: 3 Location: USA
|
Posted: Tue Mar 16, 2004 9:51 pm |
Ok got it working that way... I also tried another version on the same thing.. And tried this aswell..
#var grstatn %1
#var grstathp %2
#var grstatmv %3
#var grcount %eval( @grcount+1)
#if (@grcount=1) {#var 1group @grstatn}
#if (@grcount=1) {#var 1grouph @grstathp}
#if (@grcount=1) {#var 1groupmv @grstatmv}
All three suck... Any way to do it without the hourglass popping up, and locking me for 2 seconds? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Mar 16, 2004 10:35 pm |
Oops. I started out with three record-variables but then decided to just use a list for the names. That means the #IF is no longer needed in the second trigger, since #ADDITEM and #ADDKEY don't permit duplicates anyway.
Revised script:
#TR {1.*~]%s(%w)%s(%d)%s(%d)} {#VAR grstatn %null;#VAR grstathp %null;#VAR grstatmv %null;#ADDITEM grstatn %1;#ADDKEY grstathp %1 %2;#ADDKEY grstatmv %1 %3}
#TR {~]%s(%w)%s(%d)%s(%d)} {#ADDI grstatn %1;#ADDK grstathp %1 %2;#ADDK grstatmv %1 %3}
There's nothing here that should cause an hourglass on a max of 10 names.
EDIT: Changed variable names |
|
|
|
|
|