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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
echocaliber
Newbie


Joined: 04 Jun 2022
Posts: 3

PostPosted: Sat Jun 04, 2022 4:51 pm   

Creating an auto heal/message when group below certain health
 
hello,

So a trigger to set my group to a database, and it should be putting there health/mana etc into a variable, but I would like to expand on this for when they are low health it will either "group-say heal" when i am not on a healer, or just heal if i am can do it.

The 2 triggers i use for pulling the information works by, I type "group" then it shows the information and kicks off putting the information into a db and makes the variable for the names

Trigger 1 Pattern:

~[(*)~((*)~)H (*)~((*)~)M (*)~((*)~)V~] ~[(%d) (%w)~] {The Dragon|The Wraith|The Vampire} (%w)(*)

$CurrentHp=%1
$MaxHp=%2
$CurrentMa=%3
$MaxMa=%4
$CurrentMv=%5
$MaxMv=%6
$Level=%7
$Class=%8
$Name=%9
$Leader=%10

#NEWVAR $Name %array($CurrentHp, $MaxHp, $CurrentMa, $MaxMa, $CurrentMv, $MaxMv, $Level, $Class, $Name, $Leader)

#CALL %arrset($Name, 0, %1)
#CALL %arrset($Name, 1, %2)
#CALL %arrset($Name, 2, %3)
#CALL %arrset($Name, 3, %4)
#CALL %arrset($Name, 4, %5)
#CALL %arrset($Name, 5, %6)
#CALL %arrset($Name, 6, %7)
#CALL %arrset($Name, 7, %8)
#CALL %arrset($Name, 8, %9)
#CALL %arrset($Name, 9, %10)

#ADDITEM groupList %9

The second trigger is as follows

~[(*)~((*)~)H (*)~((*)~)M (*)~((*)~)V~] ~[(%d) (%w)~] {^The}(%w)(*)

$CurrentHp=%1
$MaxHp=%2
$CurrentMa=%3
$MaxMa=%4
$CurrentMv=%5
$MaxMv=%6
$Level=%7
$Class=%8
$Name=%9
$Leader=%10

#NEWVAR $Name %array($CurrentHp, $MaxHp, $CurrentMa, $MaxMa, $CurrentMv, $MaxMv, $Level, $Class, $Name, $Leader)

#CALL %arrset($Name, 0, %1)
#CALL %arrset($Name, 1, %2)
#CALL %arrset($Name, 2, %3)
#CALL %arrset($Name, 3, %4)
#CALL %arrset($Name, 4, %5)
#CALL %arrset($Name, 5, %6)
#CALL %arrset($Name, 6, %7)
#CALL %arrset($Name, 7, %8)
#CALL %arrset($Name, 8, %9)
#CALL %arrset($Name, 9, %10)

#ADDITEM groupList %9

both are basically the same, just accounting for different forms, as the forms can mess things up.

As I said, I would like the use this to pull health information for healing.

So like

#LOOPDB @groupList
#IF $Name $CurrentHp < 60% {group-say heal $Name}
#IF @myName =myhealer {heal $Name}

so each time i type group, it puts everything then loops the db to check currenthp and heal if needed.
and if i could just put it on a timer to check this that would be cool too.

thanks
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4555
Location: Pensacola, FL, USA

PostPosted: Sat Jun 04, 2022 6:07 pm   
 
Something like this will input the group command every 10 seconds:

#ALARM "groupChecker" -10 {group}

then you can toggle it on and off with

#T+ groupChecker
#T- groupChecker
_________________
Discord: Shalimar#3679
Reply with quote
echocaliber
Newbie


Joined: 04 Jun 2022
Posts: 3

PostPosted: Sat Jun 04, 2022 8:13 pm   
 
Ok cool, that would solve the auto timer portion of it. Now I just need the correct syntax for it the cast or ask for heals if MaxHP is below a specific threshold
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4555
Location: Pensacola, FL, USA

PostPosted: Sat Jun 04, 2022 11:13 pm   
 
Hmmm... Well, we need a line that signifies that you have received all the group information there is to be had, that should be what fires the loop.

Code:
#TR {some line} {#FORALL @grouplist {
  $current=%arrget(%i, 1)
  $max=%arrget(%i, 2)
  #IF ((%concat($current, ".0")/$max)<0.6) {#IF (@myName=@myHealer) {heal %i} {group-say heal %i}}
  }}


But I see a potential problem with this...
Assuming you are multiplaying, you will be spamming yourself with messages to heal even though your healer is likely already trying to heal.
For each of your characters in the group.
_________________
Discord: Shalimar#3679
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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