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
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Thu Oct 03, 2002 11:22 am   

Some Trigger Help [Vijilante, Lightbulb, click he]
 
Hey guys, im trying to set something like this in my mud

Here's the input
Your group consists of:
Serega [Lvl:40 909hp 562ma 232mv](Fearless Leader) [This can't be changed]
Orion [Lvl:40 648hp 439ma 172mv] ---
Hotara [Lvl:40 746hp 352ma 231mv] ---

Ok here's what i want to do.
@leader_target's {serega} group has ___Hp, and ____Ma.

Something like this should happen
#alias gstats {group;does the math; grouptell Serega's group has xhp and Ymana.

Also is something like this add-able

I have set my healo variables as
healo_target_1 to healo_target_6
'-' being the value for a null healer. Is it possible to do something like this :
healo_target_1 set : Hotara
Group 'Holy Dorks' consists of:
Serega [Lvl:40 914hp 41ma 228mv] (Fearless Leader)
Orion [Lvl:40 660hp 425ma 172mv] ---
Hotara [Lvl:40 569hp 109ma 227mv] ABC

Current Healer No# 1 Hotara has 109 mana, giving him @math restore < i can set the @math myself> just wondering if i can do this...
then I hit an alias Healer 1 is out, healer 2 is set as current healer, and so if i hit statshealer
Current Healer #2 ... etc


Is this possible ? If it is can you guys help me out?

P.S thanks for any help comments or sarcastic comments.




Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Oct 03, 2002 12:42 pm   
 
For 1):
#ALIAS gstats {#VAR total_hp 0;#VAR total_mana 0;group;#T+ getGroup;#TEMP {$} {#T- getGroup;grouptell @{leader_target}'s group has @{total_hp}hp and @{total_mana}mana.}}
#TRIGGER "getGroup" {^(%w) ~[Lvl:%d (%d)hp (%d)ma %dmv](*)} {#IF ("%4" = "(Fearless Leader)") {#VAR leader_target {%1}};#ADD total_hp %2;#ADD total_mana %3}

For 2):
#ALIAS nextHealer {#ADD healer 1;#IF (@healer > 6) {#VAR healer 1}}
#TRIGGER {^@{healo_target_@healer} ~[Lvl:%d %dhp (%d)ma %dmv]*} {grouptell Current Healer #@healer @{healo_target_@healer} has %1 mana, giving him %eval(%1/amountForRestore) restore.}

Kjata
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Thu Oct 03, 2002 1:25 pm   
 
Thank's Kjata but i didn't get this to work....
Hrm the value was 0....
What is the "get group" before the trigger line??

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Thu Oct 03, 2002 1:28 pm   
 
Oh also i think here's the problem
It first grouptells 0 Ma 0 Hp
then it hits group -> not sure if it fixes or not.
Then, if i hit gstats again hp/ma var returned as 0 hence the coding is 0hp 0ma ? :(

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Oct 03, 2002 6:38 pm   
 
In the first trigger, %4 will either be "(Fearless Leader)" or " ---". You might need to replace the * with %* because of the () in the first case. Another way of doing this is to use a second trigger to get the leader's name.
#TRIGGER {^%w ~[Lvl:%d (%d)hp (%d)ma %dmv} {#ADD total_hp %2;#ADD total_mana %3} {getGroup}
#TRIGGER {^(%w) ~[Lvl:%d %dhp %dma %dmv]~(Fearless Leader~)} {#VAR leader_target %1} {getGroup}


LightBulb
Senior Member
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Oct 04, 2002 12:00 am   
 
I started fresh on it rather than try to integrate or patch someone elses code. I also got into it a little and made it a little more verbose about its responses. Regrettable I didn't like your variable naming scheme, and seeing numbers of things you might like to do in the future made the storage mechanisms a little more complex. The addition complexity in storage makes it a little harder to extract data you want in the immediate moment, but should be useful in the future. So without further adieu, here is the whole class:

#CLASS {Groups}
#ALIAS testg {#SHOW {"Your group consists of:"};#SHOW {"Serega [Lvl:40 909hp 562ma 232mv](Fearless Leader)"};#SHOW {"Orion [Lvl:40 648hp 439ma 172mv] ---"};#SHOW {"Hotara [Lvl:40 746hp 352ma 231mv] ---"};#SHOW {"Vijilante [Lvl:90 2746hp 2352ma 2231mv] ---"};#SHOW {}}
#ALIAS gstats {GroupLeader="";GroupHealers="";GroupData="";GroupUpdate=1;CurrentHealer=0;TotalHP=0;TotalMA=0;testg}
#ALIAS sethealer {#IF ("%1"!=%null) { #IF (%number("%1")>0) { #IF (%1<=%numitems(@GroupHealers)) {CurrentHealer=%1;#ECHO Healer set to {%item(@GroupHealers,%1)}.} { #ECHO Exceeded %numitems(@GroupHealers) available: {%replace(@GroupHealers,"|",", ")}.}} { #IF ("%1"!="0") {#IF (%db(@GroupData,"%1")!=%null) { #IF (%ismember("%1",@GroupHealers)) { CurrentHealer=%ismember("%1",@GroupHealers)} {#ADDITEM GroupHealers {"%1"};CurrentHealer=%numitems(@GroupHealers);#ECHO Healer set to {%1}.}} { #ECHO Character %1 not currently in group.};#IF (%ismember("%1",@CommonHealers)=0) {#ADDITEM CommonHealers {"%1"};#ECHO Added %1 to CommonHealers list.}} {#ECHO Healer set to 0--none.;CurrentHealer=0}}} { #IF (@GroupHealers!=%null) {#ADD CurrentHealer 1;#IF (@CurrentHealer>%numitems(@GroupHealers)) {CurrentHealer=1};#ECHO Healer set to {%item(@GroupHealers,@CurrentHealer)}.} { #ECHO There are no healers in list to select.}}}
#ALIAS statshealer {#IF (@CurrentHealer) { #ECHO Current healer is %item(@GroupHealers,@CurrentHealer) ~(@CurrentHealer~/%numitems(@GroupHealers)~) has %item(%db(@GroupData,%item(@GroupHealers,@CurrentHealer)),3)ma.} { #IF (@GroupHealers!=%null) { #ECHO No healer currently set, %numitems(@GroupHealers) available.} { #ECHO No healers currently available.}}}
#VAR GroupLeader {} {}
#VAR GroupHealers {} {}
#VAR GroupData {} {}
#VAR GroupUpdate {0} {0}
#VAR CommonHealers {"Hotara"|"Vijilante"}
#VAR CurrentHealer {0} {0}
#VAR TotalHP {0} {0}
#VAR TotalMA {0} {0}
#TRIGGER {^Your group consists of:$} {#T+ CapGroup}
#CLASS 0

#CLASS {Groups|CapGroup} {"disable"}
#TRIGGER {^(%w) ~[Lvl:(%d) (%d)hp (%d)ma (%d)mv~]} {#IF (@GroupUpdate) {#ADDKEY GroupData {"%1"} {%concat("%2","|","%3","|","%4")};#IF (%pos("Fearless Leader",%trigger)) {GroupLeader="%1"};#IF (%ismember("%1",@CommonHealers)) {#ADDITEM GroupHealers {"%1"}};#ADD TotalHP %3;#ADD TotalMA %4} { #SUB {%concat("%1"," [Lvl:","%2"," ","%3","hp ","%4","ma ","%5","mv] ",%ismember("%1",@GroupHealers),%if(%ismember("%1",@GroupHealers)=@CurrentHealer,C,H))}}}
#TRIGGER {^$} {#IF (@GroupUpdate) {GroupUpdate=0;#T- CapGroup;#IF (%numitems(@GroupHealers)>1) {CurrentHealer=0|0;#LOOPDB @GroupData { #IF (%ismember(%key,@GroupHealers)) { #IF (%number(%item(%val,3))>%number(%item(@CurrentHealer,2))) { CurrentHealer=%concat(%ismember(%key,@GroupHealers),"|",%item(%val,3))}}};#DELNITEM CurrentHealer 2} { #IF (@GroupHealers!=%null) {CurrentHealer=1}};grouptell @{GroupLeader}'s group has @{TotalHP}hp @{TotalMA}ma}}
#CLASS 0

I currently have it set to run my test alias, once your satisfied switch that to the group command and remove the test alias.
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Tue Oct 08, 2002 11:33 am   
 
I beleive i confused myself

Lets remove all the complicated stuff.


Lets start again :)

Awaiting Great Wisdom from Packy.' consists of:
Link [Lvl:40 1064hp 225ma 284mv] (Fearless Leader)
Serega [Lvl:40 909hp 314ma 238mv] 2.Boner
Zuzu [Lvl:40 506hp 335ma 158mv] bone bracer
Singin [Lvl:40 720hp 384ma 193mv] dragonscale cloak
Kitn [Lvl:40 630hp 261ma 228mv] talisman of flame
Delving [Lvl:32 388hp 159ma 133mv] (Absent)
Barony [Lvl:40 672hp 382ma 176mv] ---
Dariel [Lvl:40 819hp 273ma 153mv] Bracer of Flames



Just tell me how to count HP and MA of group, thx.


Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Oct 08, 2002 12:54 pm   
 
#TRIGGER {^(*) consists of:$} {#VAR curGroup {%1};#VAR totHp 0;#VAR totMana 0;#TEMP {$} {#T- getGroup;#SAY The group @curGroup has @totHp hp and @totMana mana.};#T+ getGroup}
#TRIGGER "getGroup" {^%w ~[Lvl:%d (%d)hp (%d)ma %dmv~]*} {#ADD totHp %1;#ADD totMana %2}

Kjata
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Tue Oct 08, 2002 1:30 pm   
 
#TRIGGER "getGroup" {^%w ~[Lvl:%d (%d)hp (%d)ma %dmv~]*} {#ADD totHp %1;#ADD totMana %2}

Hrm confused, what's the "getgroup" up there??
Does that mean class getgroup or what under trigger pattern i put it as "get group" [lvl etc etc]

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Oct 08, 2002 10:04 pm   
 
What I posted is desgined to be entered in the command line. If you wish to enter it using the text editor, I will highlight the different parts:
#TRIGGER {^(*) consists of:$} {#VAR curGroup {%1};#VAR totHp 0;#VAR totMana 0;#TEMP {$} {#T- getGroup;#SAY The group @curGroup has @totHp hp and @totMana mana.};#T+ getGroup}
#TRIGGER "getGroup" {^%w ~[Lvl:%d (%d)hp (%d)ma %dmv~]*} {#ADD totHp %1;#ADD totMana %2}

Stuff in red is to be entered as the trigger's pattern
Stuff in blue is to be entered as the trigger's value (commands)
Stuff in green is to be entered as the trigger's ID (found in the Advanced tab)

If you give a trigger an ID, you can use the #T+ and #T- command to enable/disable the trigger. This saves you from having to create yet another class to contain this trigger. This is useful for when you only want to enable/disable one trigger at a time. Some other commands also accept trigger IDs.

Kjata
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Wed Oct 09, 2002 3:51 pm   
 
Where is this 'advanced tab'
I use Zmud 5.55 and am unable to find it.
Where is it located exactly, cause it's not on the trigger section.

Instead of using text editor, how else do i add this in? How do i use the other way?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Oct 09, 2002 9:05 pm   
 
Short suggestion: use 6.16, it is so much better and upgrades are always free.

Long suggestion, use these triggers instead (again, they are designed to be entered at the command line - just cut and paste it into the command line and press enter):
#TRIGGER {^(*) consists of:$} {#VAR curGroup {%1};#VAR totHp 0;#VAR totMana 0;#TEMP {$} {#T- getGroup;#SAY The group @curGroup has @totHp hp and @totMana mana.};#T+ getGroup}
#TRIGGER {^%w ~[Lvl:%d (%d)hp (%d)ma %dmv~]*} {#ADD totHp %1;#ADD totMana %2} "getGroup"

Kjata
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Fri Oct 11, 2002 11:16 am   
 
Thank you for you're replies but Zmud 6.x does not work well with my xp, it was kinda like laggy and the dirs command didn't work
for example
#al vault {.35w9d3nen2n3e4n} didn't work.
And i had some hard time with how the alias were...

Anyways back to my problem, i couldn't get you're code to work Kjata, so i did something like this.

#tr {^%1 ~[Lvl:%2 (%3)hp (%4)ma %5mv~]*} {#ADD totHp %3;#ADD totMana %4}

#tr {^(*) consists of:$}{#VAR curGroup {%1}};{#if (@tothp = 0) {#nop} {grouptell @leader_target's group has c15@totHpc02 hp and c17@totManac02 mana.}}

#alias gr {group;#ALARM +5 {gm}}
#alias gm {#var tothp 0;#var totmana 0}


I know it sucks, but that was the best i could come up with, Thanks :)

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Oct 12, 2002 4:27 pm   
 
The problem with the speedwalk not working is easily fixed with these commands:
#CLASS {System|Directions}
#DIR ns {n|north} n
#DIR sn {s|south} s
#DIR ew {e|east} e
#DIR we {w|west} w
#DIR ud {u|up} u
#DIR du {d|down} d
#CLASS {System|DirectionsDiag}
#DIR hl {nw|nothwest} nw
#DIR lh {se|southeast} se
#DIR jk {ne|northeast} ne
#DIR kj {sw|southwest} sw
#CLASS 0

Kjata
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