|
Blaize Newbie
Joined: 25 Feb 2008 Posts: 4
|
Posted: Mon Feb 25, 2008 9:54 pm
Healing Script |
I need help creating a healing script that assigns macro keys to the most hurt, the 2nd most hurt, etc. The script is for a group of players. Here is a sample of group report when the command group is typed.
Code: |
<> group
Your group consists of:
( Head) 2308/4393 hit, 213/213 move Riglior
(Front) 1730/1730 hit, 141/141 move Bariston
(Back) 587/774 hit, 132/132 move Kazzy
(Front) 2246/3446 hit, 131/131 move Omeron
< 2246h/3446H 131v/131V Pos: standing >
|
I don't know how to setup a proper array or use cmud's database to configure healing. Basically, I want to press F3 to cast 'heal' on the greatest injured (percentage wise), F4 to heal the second most hurt (precentage wise), F5 to heal the most injured (hitpoint difference) and F6 for the 2nd most injured (hitpoint difference). When group is typed again, the arrray should reset.
Thanks for any assistance or points on how to get started. |
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Mon Mar 03, 2008 11:45 pm |
OK, the following trigger will capture the relevant data from you group members:
(WARNING: I am not an expert!)
Code: |
#TRIGGER htrig {^Your group consists of\:$} {heallist = "";#CALL %vartype(heallist,4)}
#COND {\((.+(?=\)))\)\s*(\d+)/(\d+)\s*hit,\s*(\d+)/(\d+)\s*move\s*(\w+)} {command_alias} {LoopLines|Param=99} "" "regex"
#COND {^\<} {process_alias_name;#STATE htrig 0;#T- htrig}
|
For the first #COND, commands refers to whatever you want to do with the information captured by the trigger. Here is where you can put this in stringlist, etc.
Personally, I would use both database records to hold the data for each member of the group and then place the record in a stringlist that can be processed in a #FORALL statement. By the way, just use an alias and place it as the command. It makes the trigger simpler to mantain. If you want the trigger to do something else but want to capture the same data, you modify the alias, not the trigger.
So you would have something like this:
Code: |
#ALIAS command_alias {$dbentry = "";#CALL %vartype($dbentry,5);#ADDKEY $dbentry {Position=%1|CurrentHP=%2|MaxHP=%3|CurrentMV=%4|MaxMV=%5|Member=%6};heallist = %additem($dbentry,@heallist)}
|
I use %additem instead of #ADDITEM to avoid the unlikely situation where two records will be exactly the same.
Now, it isn't really necessary to use %vartype. I put them in because I am compulsive about details (*SRHUG).
As I said before, you don't need to put this in an alias, you can put this directly into the trigger body. This way, though, is easier to mantain (IMHO).
Within the alias process_alias_name you can do whatever you like with your data. Such as:
Code: |
#ALIAS process_alias_name {....;#FORALL @heallist {...};...}
|
The fun thing about doing it that way is that %i holds the db record.
Finally, you'll need a kick-off alias that will do a #T+ htrig to get the ball rolling.
This may be kind of lame but I hope it gives you ideas.
EDIT: To assign commands to a macro key, use code similar to this (I am assigning the ALT-H, you use what ever you want):
Code: |
#KEY ALT-H {heal @mosthurt}
|
You can put whatever commands you went within the braces. |
|
_________________ Sic itur ad astra.
Last edited by Anaristos on Tue Mar 04, 2008 12:27 am; edited 1 time in total |
|
|
|
Blaize Newbie
Joined: 25 Feb 2008 Posts: 4
|
Posted: Tue Mar 04, 2008 12:13 am |
Thank you! I will load this up and give it whirl tonight.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 04, 2008 12:18 am |
Much easier than doing a lookahead would be to use a more specific pattern than .+ inside the first set of brackets. Since the bracket you're looking ahead to is already in the pattern, repeating yourself isn't needed. Some other options are \w+ and [^)]+
|
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Tue Mar 04, 2008 12:36 am |
OK, as Fang suggested, the trigger can be simpilfied as follows:
Code: |
#TRIGGER htrig {^Your group consists of\:$} {heallist = "";#CALL %vartype(heallist,4)}
#COND {\((\w+)\)\s*(\d+)/(\d+)\s*hit,\s*(\d+)/(\d+)\s*move\s*(\w+)} {command_alias} {LoopLines|Param=99} "" "regex"
#COND {^\<} {process_alias_name;#STATE htrig 0;#T- htrig}
|
|
|
_________________ Sic itur ad astra. |
|
|
|
|
|
|
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
|
|