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
shibbidy joe
Wanderer


Joined: 02 Nov 2002
Posts: 76
Location: Tuvalu

PostPosted: Fri Feb 07, 2003 5:48 am   

GemStone III Healing script
 
Here's what I've got. Note that it's untested (I haven't found a volunteer yet, and I'm afraid to test it in the normal course of my healing, in case it goes into a trigger loop or shouts profanities or something).


#CLASS {healscript}
#ALIAS heal {#if (%1) {#var patient {%1};#var wounds "";getWounds}}
#ALIAS getWounds {#t+ woundsTrig;app @patient;#t- woundsTrig;#if (@wounds) {transferWounds}}
#ALIAS transferWounds {#forall @wounds {tr @patient %i};healBlood}
#ALIAS healBlood {#t+ bloodAgain;#t+ healed;#if (@hp>100) {tr @patient};#t- bloodAgain;#t- healed}
#VAR patient {}
#VAR wounds {}
#TRIGGER "woundsTrig" {You take a quick appraisal of %w and find that %w has (*).} {#if (%pos( no apparent, %1)) {healblood} {#if (%pos( left eye, %1)) {#additem wounds {left eye}};#if (%pos( left arm, %1)) {#additem wounds {left arm}};#if (%pos( left hand, %1)) {#additem wounds {left hand}};#if (%pos( left leg, %1)) {#additem wounds {left leg}};#if (%pos( right eye, %1)) {#additem wounds {right eye}};#if (%pos( right arm, %1)) {#additem wounds {right arm}};#if (%pos( right hand, %1)) {#additem wounds {right hand}};#if (%pos( right leg, %1)) {#additem wounds {right leg}};#if (%pos( head, %1)) {#additem wounds {head}};#if (%pos( neck, %1)) {#additem wounds {neck}};#if (%pos( chest, %1)) {#additem wounds {chest}};#if (%pos( abdominal, %1)) {#additem wounds {abdominal}};#if (%pos( a case, %1)) {#additem wounds {a case}};#if (%pos( twitching, %1)) {#additem wounds {twitching}}}} "" {disable}
#TRIGGER "healed" {lack of blood} {#say Healed} "" {disable}
#TRIGGER "bloodAgain" {health points} {healBlood} "" {disable}
#CLASS 0

(continued next post..)
Reply with quote
shibbidy joe
Wanderer


Joined: 02 Nov 2002
Posts: 76
Location: Tuvalu

PostPosted: Fri Feb 07, 2003 5:51 am   
 
(...contined from last post.)

Basic synopsis:
I type heal joe and it sends app joe (short for appraise), and captures the string containing the wounds in the %1 variable. Text received is:
You take a quick appraisal of Joe and find that he has a big lump on his head, a severed left leg, a mangled right leg, and a bruised right eye.
(I made up the wounds, but they do contain the respective words such as head, left leg, right leg and right eye.) I want it to capture everything after ...and find that he/she has. Then I want it to check to see if the string has any of the potential wounds mentioned in it (i.e. head). Note that if there are no wounds, the message is You take a quick appraisal of Joe and find that he has no apparent injuries. (Sometimes injuries is replaced with wounds.) If it notices any wounds, I want it to take them using transfer joe head. Then I want it to wait until the text You meditate over Joe is received, then move on to the next wound. Once there are no wounds, it should activate the healBlood alias. (This alias might also be activated by the ...he has no apparent injuries/wounds.) Blood is transfered using transfer joe, and it should only transfer blood if the @hp variable is greater than 100. If @hp is less than 100 it should use transfer joe any instead until Joe's fully healed. (When blood is still missing, something along the lines of You take 50 health points upon yourself. is received. When no blood is missing, the text Joe does not appear to be suffering from a lack of blood. is received instead. These messages are received when using transfer joe and transfer joe any.)
The two problems I'm faced with are making it wait for the You meditate over before transfering the next wound, and forcing it to use transfer joe any instead of transfer joe when @hp is not greater than 100. The latter I could probably solve on my own, but I'm just trying to get this out tonight before I go to sleep. The former, however, I'm going to need help with.

If anyone needs clarification, sees any bugs or potential bugs, or can give me a solution to either of these problems, please please please let me know.

Much thanks,
-Shib
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Fri Feb 07, 2003 6:11 am   
 
i'm seeing a couple of things, just off the top of my head:

#ALIAS getWounds {
#T+ woundsTrig
app @patient
#WAIT
#T- woundsTrig
#IF (@wounds) {transferWounds}
}

the #wait you'll need so that the trigger isn't disabled before the incoming text is recieved.
for the two transfer options, replace "tr" with this alias

#alias trany {
#if (@hp > 100) {tr %1} {tr %1 any}
}

#ALIAS transferWounds {
#FORALL @wounds {tr @patient %i}
healBlood
}

you can adjust this to have it step one wound at a time in this manner:

#alias transferwounds {
tr @patient %item(@wounds, 1)
#delnitem wounds 1
#if (@wounds) {#t+ mediwait}
}
#tr "mediwait" {You meditate over @patient} {
tr @patient %item(@wounds, 1)
#delnitem wounds 1
#if (@wounds) {#NOOP} {#t- mediwait}
}

hope that helps, looks like you put alot of work into this script :)

--------

moon.icebound.net:9000
Reply with quote
shibbidy joe
Wanderer


Joined: 02 Nov 2002
Posts: 76
Location: Tuvalu

PostPosted: Fri Feb 07, 2003 5:03 pm   
 
Ok, here's the revision. Changes in red:
#CLASS {healscript}
#ALIAS heal {#if (%1) {#var patient {%1};#var wounds "";getWounds} {health}}#ALIAS getWounds {#t+ woundsTrig;app @patient;#wait;#t- woundsTrig;#if (@wounds) {transferWounds}}
#ALIAS transferWounds {#if (@wounds) {#t+ mediwait;tr @patient %item( @wounds, 1)} {#t- mediwait;healBlood}}
#ALIAS healBlood {#t+ bloodAgain;#t+ healed;trany;#wait;#t- bloodAgain;#t- healed}
#ALIAS trany {#if (@hp > 100) {tr %1} {tr %1 any}}
#VAR patient {}
#VAR wounds {}
#TRIGGER "woundsTrig" {You take a quick appraisal of %w and find that %w has (*).} {#if (%pos( no apparent, %1)) {healblood} {#if (%pos( left eye, %1)) {#additem wounds {left eye}};#if (%pos( left arm, %1)) {#additem wounds {left arm}};#if (%pos( left hand, %1)) {#additem wounds {left hand}};#if (%pos( left leg, %1)) {#additem wounds {left leg}};#if (%pos( right eye, %1)) {#additem wounds {right eye}};#if (%pos( right arm, %1)) {#additem wounds {right arm}};#if (%pos( right hand, %1)) {#additem wounds {right hand}};#if (%pos( right leg, %1)) {#additem wounds {right leg}};#if (%pos( head, %1)) {#additem wounds {head}};#if (%pos( neck, %1)) {#additem wounds {neck}};#if (%pos( chest, %1)) {#additem wounds {chest}};#if (%pos( abdominal, %1)) {#additem wounds {abdominal}};#if (%pos( a case, %1)) {#additem wounds {a case}};#if (%pos( twitching, %1)) {#additem wounds {twitching}}}} "" {disable}
#TRIGGER "healed" {lack of blood} {#say Healed} "" {disable}
#TRIGGER "bloodAgain" {health points} {trany} "" {disable}
#TRIGGER "mediwait" {You meditate over @patient} {#delnitem wounds 1;#if (@wounds) { tr @patient %item( @wounds, 1)} {#t- mediwait;healBlood}} "" {disable}
#CLASS 0

So... Anyone see anything? Thanks again,
-Shib

[Edited: added another revision (in blue). It sends health to mud when I type heal without an argument.]
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Fri Feb 07, 2003 8:31 pm   
 
quote:

#TRIGGER "bloodAgain" {health points} {trany} "" {disable}



the %1 in the trany alias is the argument, so you should call it like this:

trany @patient

thats the only thing i can see, looks like you might be ready to start testing it :)

--------

moon.icebound.net:9000
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