Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Milton
Newbie


Joined: 31 Dec 2002
Posts: 4
Location: USA

PostPosted: Tue Dec 31, 2002 10:44 pm   

capture group status to window
 
I'm looking to create a way to send group status to a window of it's own. For healers, this could be helpful in fights as we need to monitor the health of group members. I could also imagine the output to be used in some kind of status display.

When I type 'group' (or 'gr') when grouped, I see something like this....

       ## BigGuy and Company ##

   BigGuy [50 Kni] [1174/1174hp 100/100 m 215/215 mv] (Leader)
   Fred [ 1 Wiz] [ 34/34 hp 115/115 m 83/83 mv]
   Sally [50 Enc] [ 315/315 hp 465/725 m 162/162 mv]
   Mark [41 Hlr] [ 520/517 hp 407/563 m 164/164 mv]


The size of the group can change over time. I'm imagining a couple of things...

1 - I could manually set a variable for the number of people in the group and then set a trigger to +1 or -1 when I see 'is added to your group' or 'leaves the group.' Then I could use that variable in the capture statement to capture a set number of lines to the other window...

2 - I could have some kind of routine that can detect the number of lines that are non-blank following trigger ## * ## (but don't know how to write that), set that as a number in a variable and then capture that number of lines to the other window...

3 - I could try to have the system track xx/XXhp yy/YY m zz/ZZ mv of each player in the group and then display those variables in some way...

Any ideas?

I'm a newbie at this. I managed to use the example in the help ZMud file to capture tells to its own window and GAG it from the main window. Can anyone help? Sample code would be very helpful.

- Milton
milton@undertheoak.net
http://undertheoak.net/cgi-bin/aw?Milton
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jan 01, 2003 5:12 am   
 
Here's a fairly simple way to capture those lines for display in a separate window:
#ADDITEM group BigGuy
#ADDITEM group Fred
#ADDITEM group Sally
#ADDITEM group Mark
#AL gr {:Group:#CLR;group}
#TR {{@group} * ~[*~]} {#CAP Group}
#TR {(%w) is added to your group} {#ADDITEM group %1}
#TR {(%w) leaves the group} {#DELITEM group %1}


Capturing the values is more difficult. I'll leave that for someone else to figure out.

LightBulb
Senior Member
Reply with quote
Drevarr
Beginner


Joined: 19 Dec 2001
Posts: 17
Location: USA

PostPosted: Wed Jan 01, 2003 6:08 pm   
 
#TRIGGER {&Name~[&level &class~]%s~[&curhp/&%dmaxhp[ hp]%s&curma/&maxma m%s&curmv/&maxmv mv~]%s~(Leader~)} {#CLR {Group Status};#ADDITEM group %1;#window {Group Status} {%1: %4 / %5};#T+ GroupCap}
#TRIGGER {&Name~[&level &class~]%s~[&curhp/&maxhp hp%s&curma/&maxma m%s&curmv/&maxmv mv~]} {#ADDITEM group %1;#window {Group Status} {%1: %4 / %5}} "GroupCap"
#TRIGGER {^$} {#T- GroupCap} "GroupCap"

This should capture your group plus all the group status elements into variables. Sends a select amount of data to a seperate window titled "Group Status". Should get you started, you can tweak the group status to be a bit more informative. I use a similiar set up to keep from loosing the info in large spam fights on a PK mud.

These triggers should net you the following data to work with:
#VAR group {BigGuy|Fred|Sally|Mark}
#VAR NAME {Mark }
#VAR LEVEL {41}
#VAR CLASS {Hlr}
#VAR CURHP { 520}
#VAR MAXHP {517}
#VAR CURMA {407}
#VAR MAXMA {563}
#VAR CURMV {164}
#VAR MAXMV {164}
Reply with quote
Milton
Newbie


Joined: 31 Dec 2002
Posts: 4
Location: USA

PostPosted: Wed Jan 01, 2003 10:44 pm   
 
Thanks! Trying the script immediately above seems to get me somewhere. I haven't tried the top one yet (still trying to understand it)

Trying this exactly...

#TRIGGER {&Name~[&level &class~]%s~[&curhp/&%dmaxhp[ hp]%s&curma/&maxma m%s&curmv/&maxmv mv~]%s~(Leader~)} {#CLR {Group Status};#ADDITEM group %1;#window {Group Status} {%1: %4 / %5};#T+ GroupCap}
#TRIGGER {&Name~[&level &class~]%s~[&curhp/&maxhp hp%s&curma/&maxma m%s&curmv/&maxmv mv~]} {#ADDITEM group %1;#window {Group Status} {%1: %4 / %5}} "GroupCap"
#TRIGGER {^$} {#T- GroupCap} "GroupCap"


...upon typing 'group' it seemed to be able to grab the first two lines and display the variable values that were called for in the script...

Thus when the MUD shows me this...

       ## Drexor and Company ##

   Drexor [50 Bzk] [ 579/1144hp 105/105 m 183/183 mv] (Leader)
   Milton [43 Hlr] [ 379/379 hp 58/575 m 166/166 mv]
   Silko [50 Kni] [1144/1144hp 100/100 m 215/215 mv]
   Kiros [50 Bzk] [ 786/1208hp 58/120 m 84/227 mv]


In the new window, I get this...

Drexor      :  579 / 1144

Milton : 379 / 379


Being the newbie that I am at this... I'm studying this to try to figure out and correct...

a) why subsequent instances of typing 'group' did not result in a refresh of the information in the new window... (e.g. as when the hp and mana changes - or as when people are added to the group)...
b) why the rest of the group was not shown (Silko and Kiros)...
c) if when this evolves it can also handle when I look at the group while some players are not in the same room as others... as in when the MUD shows me this...

      ## Drexor and Company ##

  Drexor [50 Bzk] (Leader)
  Facha [50 Hlr]
  Milton [43 Hlr] [ 404/404 hp 419/583 m 166/166 mv]
  Silko [50 Kni]
  Kiros [50 Bzk]


Thank you very much for the head start. If you or anyone else can give me any more clues, please do!

- Milton
milton@undertheoak.net
http://undertheoak.net/cgi-bin/aw?Milton
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 02, 2003 12:24 am   
 
I can't see where my script is any more difficult to understand than Drevarr's (actually, I think it's easier), but here's an explanation:
#ADDITEM group BigGuy
#ADDITEM group Fred
#ADDITEM group Sally
#ADDITEM group Mark

Creates a stringlist variable, @group, with the value {BigGuy|Fred|Sally|Mark}.
#AL gr {:Group:#CLR;group}
Clears the Group window (creates it if necessary), then sends the "group" command to the MUD.
#TR {{@group} * ~[*~]} {#CAP Group}
Captures matching lines to the Group window.
Triggers on any line that has the name of one of your group members followed by a space, then later has a [ preceded by another space and and then a ], with at least one character between the [ and the ]. For instance, in the line:
BigGuy    [50 Kni] [1174/1174hp  100/100 m  215/215 mv] (Leader)
BigGuy is one of the entries in @group, there are several spaces after his name which will count as " * ", then there's a [, the next * would be 50 Kni, and then there's the ]. So that line matches the trigger and gets #CAPtured.
#TR {(%w) is added to your group} {#ADDITEM group %1}
Adds the name to @group when someone joins the group.
#TR {(%w) leaves the group} {#DELITEM group %1}
Removes the name from @group when someone leaves the group.

By not trying to match everything, I avoided all the places where there might be anywhere from 0 to 7 (or more) spaces.

--------------------


And that's why the script you are using is having trouble, because it doesn't account for all the possible spacing. In particular, the second trigger:
#TRIGGER {&Name~[&level &class~]%s~[&curhp/&maxhp hp%s&curma/&maxma m%s&curmv/&maxmv mv~]} {#ADDITEM group %1;#window {Group Status} {%1: %4 / %5}} "GroupCap"
requires a space between &maxhp and hp. Both Silko and Kiros have maxhp's over 1000, so in both cases there is NO space between the number and "hp". Therefore, they don't match this trigger.

LightBulb
Senior Member
Reply with quote
Milton
Newbie


Joined: 31 Dec 2002
Posts: 4
Location: USA

PostPosted: Thu Jan 02, 2003 1:34 am   
 
LightBulb, this is great. Thanks! This does help me understand what's happening here.

The one thing I was trying to figure out (before I tried this out) is how to quickly add myself to a group without having to code the #ADDITEM line for each person already in the group. Perhaps (this is a stupid question?) I could create an alias for that. And for lack of not yet quite thinking through that far, I was opting to give it more study.

Would something like this work? An alias something like

 #AL newgroup {#ADDITEM group %1;#ADDITEM group %2;#ADDITEM group %3;#ADDITEM group %4;#ADDITEM group %5;#ADDITEM group %6;#ADDITEM group %7;#ADDITEM group %8;#ADDITEM group %9}

 or is there some way of automatically capturing the first word of each nonblank line following ## * ## up until there is a blank line (assuming that each nonblank line starts with spaces (left margin))?

I recognized that this would handle the display of group information. It's tempting to figure out how to set variables for the data within the display so that I might be able to reuse them in gagues (or perhaps other triggers).

Again, I really appreciate the time you took to explain that. I'm learning a lot.


- Milton
milton@undertheoak.net
http://undertheoak.net/cgi-bin/aw?Milton
Reply with quote
Drevarr
Beginner


Joined: 19 Dec 2001
Posts: 17
Location: USA

PostPosted: Thu Jan 02, 2003 1:36 am   
 
Yup, LightBulb is correct, 4 digit hitpoints don't have a space. I accounted for it in the leader trigger but not subsequent group members.

This should fix and allow for group members not in the room:

#TRIGGER {&Name~[&level &class~]%s~[&curhp/&%dmaxhp[ hp]%s&curma/&maxma m%s&curmv/&maxmv mv~]%s~(Leader~)$} {#var group %null;#T+ GroupCap;#CLR {Group Status};#ADDITEM group %1;#window {Group Status} {%1: %4 / %5}}
#TRIGGER {^&Name~[&level &class~]%s~[&curhp/&%dmaxhp[ hp]%s&curma/&maxma m%s&curmv/&maxmv mv~]$} {#ADDITEM group %1;#window {Group Status} {%1: %4 / %5}} "GroupCap"
#TRIGGER {^$} {#T- GroupCap} "GroupCap"
#TRIGGER {&Name~[([ 0-9]) &class([~]])%s~(Leader~)$} {#var group %null;#T+ GroupCap;#CLR {Group Status};#ADDITEM group %1;#window {Group Status} {%1: Not in Room}}
#TRIGGER {&Name~[([ 0-9]) %w([~]])$} {#ADDITEM group %1;#window {Group Status} {%1: Not in Room}} "GroupCap"


If you don't intend to do any calculations or tracking of the group members stats, best bet is to utilize something along the lines of LightBulb suggestion.

Group Status should be updating on subsequent group commands to reflect new members or changes in stats. It #clr's the window before updating.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 02, 2003 4:48 am   
 
To quickly add names to the @group variable, use something along the lines of what Drevarr did.
#AL newgroup {#VAR group %null;#T+ newgroup2;group}
#CLASS newgroup2 disable
#CLASS 0
#T- newgroup2
#TR {^%s(%w)%s~[} {#ADDITEM group %1} {newgroup2}
#TR {^$} {#T- newgroup2} {newgroup2}


LightBulb
Senior Member
Reply with quote
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Thu Jan 02, 2003 6:46 pm   
 
Why, why, why?????

This is WAY, WAY, WAY too complicated for what he wants to do... why not just an alias for 'gr' that turns on a capture class, and captures everything up to the next prompt????

It'd be like two lines of code, no variables and nothing complicated, no worrying about group size, either.....
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 02, 2003 7:00 pm   
 
Write your script and post it then, Az.

My initial reply consisted of one alias and one trigger to do what Milton asked (capture the lines to another window). It also had 4 additems to create the initial @group variable and two more triggers to add and remove people (another thing he asked for).

My last post was a means of automating the #ADDITEMS, and once again it was a response to something Milton specifically requested.

He did ask (in the first post) about the possibility of capturing the information to variables also, but I've declined to attempt that.

LightBulb
Senior Member
Reply with quote
ShadowDrakken
Beginner


Joined: 29 Dec 2002
Posts: 18
Location: USA

PostPosted: Thu Jan 02, 2003 7:13 pm   
 
quote:

Why, why, why?????

This is WAY, WAY, WAY too complicated for what he wants to do... why not just an alias for 'gr' that turns on a capture class, and captures everything up to the next prompt????

It'd be like two lines of code, no variables and nothing complicated, no worrying about group size, either.....


that wouldn't help for tracking new joins and parts in the group tho unless he also set it up to re-query the MUD every time someone came or left the group... could get in pretty serious trouble for that kind of spam on most MUDs :)
Reply with quote
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Fri Jan 03, 2003 12:14 am   
 
Ok, this is simple to accomplish what he's requesting:

#AL {gr} {#class capgr 1;~gr}
#CLASS {capgr} {disable}
#TR {*} {#cap group} "capgr"

The only other thing you would need is a line in the commands of your prompt trigger that says:

#CLASS capgr 0

The only thing he asked for was a way to capture the info to a separate window. This would accomplish that, and he could refresh it as desired, and it doesn't CARE how many people are in the group

The only other thing I would do is to open the class properties for 'capgr' and set it to be disabled on connect, so it's not enabled by default.(edit: Modified the above script a bit... it SHOULD already be set like that...)
Reply with quote
Milton
Newbie


Joined: 31 Dec 2002
Posts: 4
Location: USA

PostPosted: Sun Jan 12, 2003 8:18 pm   
 
This is great. Thank you very much! I have three different methods to try out. One that will do a straight-forward display; One that will track members in the group; and another that will track name, level, class, hp/maxhp..etc.

It's taken a while (holidays and all) for me to get this just so... so I feel I've given it a decent try... and so that I have something decent to come back with. I tried the full variable set (a la Drevarr) and have this to report back, for now. I also modified the triggers to get a display that looks like what the mud gives. Here's what I have 5 triggers...



trigger - &Name~[&level &class~]%s~[&curhp/&%dmaxhp[ hp]%s&curma/&maxma m%s&curmv/&maxmv mv~]%s~(Leader~)$
#var group %null
#T+ GroupCap
#CLR {Group Status}
#ADDITEM group %1
#window {Group Status} {%1: ~[%2 %3~] ~[%4/%5 %6/%7 %8/%9~]}
trigger - &Name~[([ 0-9]) &class([~]])%s~(Leader~)$
#var group %null
#T+ GroupCap
#CLR {Group Status}
#ADDITEM group %1
#window {Group Status} {%1: Not in Room}
*** possible delete ***
trigger - &Name~[([ 0-9]) %w([~]])$
#ADDITEM group %1
#window {Group Status} {%1: Not in Room}
trigger - ^$
#T- GroupCap
trigger - ^&Name~[&level &class~]%s~[&curhp/&%dmaxhp[ hp]%s&curma/&maxma m%s&curmv/&maxmv mv~]$
#ADDITEM group %1
#window {Group Status} {%1: ~[%2 %3~] ~[%4/%5 %6/%7 %8/%9~]}


... which, when the mud displays...


## Grom and Company ##
Grom [47 Sor] [ 373/415 hp 190/642 m 117/117 mv] (Leader)
Saurug [33 Bzk] [ 671/671 hp 100/100 m 149/149 mv]
Chuck [38 Cru] [ 308/308 hp 490/490 m 153/153 mv]
Loxar [22 Sor]
Zulog [44 Cru] [ 396/396 hp 505/555 m 128/128 mv] (Rear)
Milton [44 Hlr] [ 411/411 hp 37/584 m 167/167 mv] (Middle)


I get this in a window called Group Status
Grom        : Not in Room

Saurug : [33 Bzk] [ 671/671 100/100 149/149]
Chuck : [38 Cru] [ 308/308 490/490 153/153]
Loxar : Not in Room


This is really good in that:
- it shows all relevant stats on members of the group in the room who do not have some kind of (Leader)(Rear)(Middle) tag.
- if the person is not in the room, then it will not show that person (e.g. Loxar)

However:
- it will never show the (Leader) - There has to be something wrong with that trigger, or the one that tries to detect the leader if the leader is not in the room.
- it will never show anyone whom has a tag, such as (Middle) or (Rear). I think this means that triggers need to be set for those instances.

So, currently, I'm studying these to see if I can figure out how to address these things.

I'm also seeking to color code the lines based on percentage of hp to maxhp (like I saw in some help on a gauge).

Many thanks again for the above help. If you have any suggestions or modification of code toward these goals, I'd be very grateful. Any ideas? Thx in advance. Kind regards...

- Milton
milton@undertheoak.net
http://undertheoak.net/cgi-bin/aw?Milton
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net