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
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Fri Mar 19, 2021 8:19 am   

One prompt to rule them all! (multi windows)
 
Hi, I have the below in a .pkg all characters can see. If I separate each one "Sutex" "Halix" "Zarlix" into their own windows/pkg it works.
But trying to see if its possible to have an "all in one"

This is my effort so far. Tab lost with the correct syntax, how to get it to read the prompt and associated it with the name of the window, either "Sutex" "Halix" "Zarlix"
I have a group trigger that captures all the max values and names which is placed into a variable database, that's the @Sutex.maxhp you see and that works great.

This is the prompt trigger that is always displayed (%d)hp (%d)m (%d)mv > the below code is set too.
Code:

#IF (%window = "Sutex") {Sutex.hp = %1;Sutex.maxhp = %2;Sutex.ma = %3;Sutex.maxma = %4}
#VAR @heal_member "Sutex"
#math hp_difference (@Sutex.hp - @Sutex.maxhp)
#math hp_percentage (@Sutex.hp*100/@Sutex.maxhp)
#if @shp_difference<@stemp_hp {temp_hp=@shp_difference
#if @shp_percentage<@stemp_percentage {stemp_percentage=@shp_percentage
#if @shp_percentage<21 {#math shp_difference (@Sutex.maxhp-@Sutex.hp)
#VAR @heal_member "Sutex"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@shp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blink, red)dying %ansi( bold, white)~| %ansi( bold, blink, red)@shp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @shp_percentage<41 {#math shp_difference (@Sutex.maxhp-@Sutex.hp)
#VAR @heal_member "Sutex"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@shp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, red)hurting %ansi( bold, white)~| %ansi( bold, blink, red)@shp_percentage%ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @shp_percentage<61 {#math shp_difference (@Sutex.maxhp-@Sutex.hp)
#VAR @heal_member "Sutex"
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@shp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blue)wounded %ansi( bold, white)~| %ansi( bold, blink, red)@shp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @shp_percentage<91 {#math shp_difference (@Sutex.maxhp-@Sutex.hp)
zccw
#abort 1}

#IF (%window = "Halix") {Halix.hp = %1;Halix.maxhp = %2;Halix.ma = %3;Halix.maxma = %4}
#VAR @heal_member "Halix"
#math hp_difference (@Halix.hp - @Halix.maxhp)
#math hp_percentage (@Halix.hp*100/@Halix.maxhp)
#if @hhp_difference<@htemp_hp {htemp_hp=@hhp_difference
#var healfirst @heal_member}
#if @hhp_percentage<@htemp_percentage {htemp_percentage=@hhp_percentage
#var healmefirst @heal_member}
#if @hhp_percentage<21 {#math hhp_difference (@Halix.maxhp-@Halix.hp)
#VAR @heal_member "Halix"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@hhp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blink, red)dying %ansi( bold, white)~| %ansi( bold, blink, red)@hhp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @hhp_percentage<41 {#math hhp_difference (@Halix.maxhp-@Halix.hp)
#VAR @heal_member "Halix"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@hhp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, red)hurting %ansi( bold, white)~| %ansi( bold, blink, red)@hhp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @hhp_percentage<61 {#math hhp_difference (@Halix.maxhp-@Halix.hp)
#VAR @heal_member "Halix"
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@hhp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blue)wounded %ansi( bold, white)~| %ansi( bold, blink, red)@hhp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @hhp_percentage<91 {#math hhp_difference (@Halix.maxhp-@Halix.hp)
zccw
#abort 1}

#IF (%window = "Zarlix") {Zarlix.hp = %1;Zarlix.maxhp = %2;Zarlix.ma = %3;Zarlix.maxma = %4}
#VAR @heal_member "Zarlix"
#math hp_difference (@Zarlix.hp - @Zarlix.maxhp)
#math hp_percentage (@Zarlix.hp*100/@Zarlix.maxhp)
#if @zhp_difference<@ztemp_hp {ztemp_hp=@zhp_difference
#if @zhp_percentage<@ztemp_percentage {ztemp_percentage=@zhp_percentage
#if @zhp_percentage<21 {#math zhp_difference (@Zarlix.maxhp-@Zarlix.hp)
#VAR @heal_member "Zarlix"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@zhp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blink, red)dying %ansi( bold, white)~| %ansi( bold, blink, red)@zhp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @zhp_percentage<41 {#math zhp_difference (@Zarlix.maxhp-@Zarlix.hp)
#VAR @heal_member "Zarlix"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@zhp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, red)hurting %ansi( bold, white)~| %ansi( bold, blink, red)@zhp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @zhp_percentage<61 {#math zhp_difference (@Zarlix.maxhp-@Zarlix.hp)
#VAR @heal_member "Zarlix"
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@zhp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blue)wounded %ansi( bold, white)~| %ansi( bold, blink, red)@zhp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @zhp_percentage<91 {#math zhp_difference (@Zarlix.maxhp-@Zarlix.hp)
zccw
#abort 1}



A Single example in its own window.
Code:

:SUTEX:Sutex.hp = %1
:SUTEX:Sutex.ma = %2
:SUTEX:Sutex.mv = %3
hp = %1
ma = %2
mv = %3
#math hp_difference (@Sutex.hp - @Sutex.maxhp)
#math hp_percentage (@Sutex.hp*100/@Sutex.maxhp)
#if @hp_difference<@temp_hp {temp_hp=@hp_difference
#var healfirst @heal_member}
#if @hp_percentage<@temp_percentage {temp_percentage=@hp_percentage
#var healmefirst @heal_member}
#if @hp_percentage<21 {#math hp_difference (@maxhp-@hp)
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blink, red)dying %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage%ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @hp_percentage<41 {#math hp_difference (@maxhp-@hp)
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, red)hurting %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage%ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @hp_percentage<61 {#math hp_difference (@maxhp-@hp)
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blue)wounded %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage%ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1}

#if @hp_percentage<91 {#math hp_difference (@Zarlix.maxhp-@Zarlix.hp)
zccw
#abort 1}
_________________
Entropy rules
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Fri Mar 19, 2021 10:37 am   
 
So it is the same code but for different chars.

Why not SWITCH?

("sutek") {$char="sutek";set more sutek stuff}
("halix") {$char="halix"; set more halix stuff}
("zartix") {$char="zartix" set more zartix stuff}

do $char
show ${char}vars
${char}hp=%1
${char}mn=%2
${char}mv=%3

etc

Why SAY and not WIN?

Plus, it is likely that if you don't qualify the hp mn mv vars at the top you are probably creating issues.
If you try

class/hp=value
class/mn=value
class/mv=value

...and you can SWITCH the hp_precentage also
#LOCAL $hurt_text
SWITCH (@hp_pct)
(@hp_pct<=20) {$hurt_text="dying"}
(@hp_pct<=60) {$hurt_text="hurting"}
(@hp_pct<=90) {$hurt_text="wounded"}
etc

#SAY "WHAT!"@heal_member "is" $hurt_text

I am guessing you can also do {$hurt_text=%ansi(blah,blah)}
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 168

PostPosted: Fri Mar 19, 2021 11:54 am   
 
also, and I think Shalimar would agree.

use ()'s in your #IF's
#if (@hp_difference<@temp_hp) {temp_hp=@hp_difference

#MATH can be removed entirely
hp_difference = (@Sutex.hp - @Sutex.maxhp)
Reply with quote
shalimar
GURU


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

PostPosted: Fri Mar 19, 2021 12:29 pm   
 
No need for a switch when you have %window (named for the char) available.

All the stuff that needs to be exclusive to the character can be shunted off like so:

#EXECWIN %window {
#ADDKEY %window hp %1
#ADDKEY %window ma %2
#ADDKEY %window mv %3
hp_difference=(%db(@{%window},hp) - %db(@{%window},maxhp))
}
_________________
Discord: Shalimarwildcat
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Fri Mar 19, 2021 1:00 pm   
 
shalimar wrote:
No need for a switch when you have %window (named for the char) available.

All the stuff that needs to be exclusive to the character can be shunted off like so:

#EXECWIN %window {
#ADDKEY %window hp %1
#ADDKEY %window ma %2
#ADDKEY %window mv %3
hp_difference=(%db(@{%window},hp) - %db(@{%window},maxhp))
}


Ok I can understand that more or less, @hpoonis2010 the Switch never new about it in Cmud, takes me back to C++ and I was really bad at that too :)
_________________
Entropy rules

Last edited by Sutex-Kindred on Fri Mar 19, 2021 1:07 pm; edited 1 time in total
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Fri Mar 19, 2021 1:03 pm   
 
chaossdragon wrote:
also, and I think Shalimar would agree.

use ()'s in your #IF's
#if (@hp_difference<@temp_hp) {temp_hp=@hp_difference

#MATH can be removed entirely
hp_difference = (@Sutex.hp - @Sutex.maxhp)


Ok was worked in for some other purpose long ago.
_________________
Entropy rules
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Fri Mar 19, 2021 4:04 pm   
 
With the editor in CMUD this complied fired got output to the screen

Code:

#IF (%window = "Sutex") {
  Sutex.hp = %1
  Sutex.maxhp = %2
  Sutex.ma = %3
  Sutex.maxma = %4
  }
#EXECWIN %window {"Sutex"}
#ADDKEY %window hp %1
#ADDKEY %window ma %2
#ADDKEY %window mv %3
hp_difference=(%db( @{%window}, hp) - %db( @{%window}, maxhp))
#VAR @heal_member "Sutex"
#math hp_percentage (@Sutex.hp*100/@Sutex.maxhp)
#if @hp_percentage<21
#VAR @heal_member "Sutex"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blink, red)dying %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1#if @hp_percentage<41
#VAR @heal_member "Sutex"
#SAY {"Health"%ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, red)hurting %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage%ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1#if @hp_percentage<61
#VAR @heal_member "Sutex"
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blue)wounded %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
zph
#abort 1#if @hp_percentage<91
zccw
#abort 1


This is trigger is in a 'Everyone.pkg' Everyone can see. So I just have to add the same code for each other Character (changing the names) underneath Sutex above?

I'm using #VAR @heal_member "Sutex" as to pull the names either Sutex Halix or Zarlix out of the variable DB requires the %ismember correct?

And the variable each one uses stays within their windows/.pkg?

I have a variable DB for each Charterer which holds all the values need generated by the Group command and trigger. "Sutex.maxhp"

Been a few years since Ive dusted of Cmud just running it past you all.
_________________
Entropy rules
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Sat Mar 20, 2021 11:43 am   
 
Cant get it to stop looping and the values don't work, not working as intended I need to add %ismember to pull the correct Name out of the @heal_member too.

This fires on the normal prompt, suppose too, if! hurt dying etc.

#IF (%window = "Sutex") {
Sutex.hp = %1
Sutex.maxhp = %2
Sutex.ma = %3
Sutex.maxma = %4
}
#EXECWIN %window {"Sutex"}
#ADDKEY %window hp %1
#ADDKEY %window ma %2
#ADDKEY %window mv %3

hp_percentage (@Sutex.hp*100/@Sutex.maxhp)
#VAR heal_member Sutex
#IF (@hp_percentage<21) {
hp_difference=(%db( @{%window}, Sutex.hp) - %db( @{%window}, Sutex.maxhp))
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blink, red)dying %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
#abort 1}

#if (@hp_percentage<41) {
hp_difference=(%db( @{%window}, Sutex.hp) - %db( @{%window}, Sutex.maxhp))
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, red)hurting %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage%ansi( bold, green)~% %ansi( bold, white)~]}
#abort 1}

#if (@hp_percentage<61) {
hp_difference=(%db( @{%window}, Sutex.hp) - %db( @{%window}, Sutex.maxhp))
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blue)wounded %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
#abort 1}

#if (@hp_percentage<81) {
hp_difference=(%db( @{%window}, Sutex.hp) - %db( @{%window}, Sutex.maxhp))
#SAY {"Health Difference" %ansi( bold, white)~[ %ansi( bold, green)-@hp_difference %ansi( bold, white)~| %ansi( bold, cyan)@heal_member is %ansi( bold, blue)small wounds %ansi( bold, white)~| %ansi( bold, blink, red)@hp_percentage %ansi( bold, green)~% %ansi( bold, white)~]}
#abort 1}


This is my Group trigger which get all the high values puts then in a data base 'Everyone can see'

#IF (%10 = "Sutex") {Sutex.hp = %1;Sutex.maxhp = %2;Sutex.ma = %3;Sutex.maxma = %4}
#IF (%10 = "Halix") {Halix.hp = %1;Halix.maxhp = %2;Halix.ma = %3;Halix.maxma = %4}
#IF (%10 = "Zarlix") {Zarlix.hp = %1;Zarlix.maxhp = %2;Zarlix.ma = %3;Zarlix.maxma = %4}
#IF (%10 = "Karlix") {Karlix.hp = %1;Karlix.maxhp = %2;Karlix.ma = %3;Karlix.maxma = %4}
_________________
Entropy rules
Reply with quote
shalimar
GURU


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

PostPosted: Mon Mar 22, 2021 11:02 am   
 
You aren't doing it like in my example.

You abbreviated it to:

#EXECWIN %window {"Sutex"}

Yet %window is already Sutex (or one of the other char names) so unless you have a self-named alias, this does nothing.

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

In the same vein
%db( @{%window}, Sutex.hp)
should be
%db( @{%window}, hp)
because %window -IS- Sutex, you are trying to reference an @sutex.sutex.hp

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

Moving on to your group example, since you want everyone to have access to the data... move all the individual member data into a collective of group data.

$member=%db(@groupStats, %10)
#ADDKEY $member hp %1
#ADDKEY $member maxHp %2
#ADDKEY $member ma %3
#ADDKEY $member maxMa %4
#ADDKEY groupStats %10 $member

The only drawback of putting this data into a database is that gauges do not update properly. Gauges really like stand-alone variables.
_________________
Discord: Shalimarwildcat
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Mon Mar 22, 2021 11:23 am   
 
Will read through more carefully what your suggesting thanks. below is to clarify my set up

.......................

My group trigger is in the 'Everyone can see' it controls updates my status buttons health mana, with their Max levels

~[{%s|}(%d)~/(%d){%s|}~]~[{%s|}(%d)~/(%d){%s|}~]~[{%s|}(%d)~/(%d){%s|}~] ~[{%s|}(%n)~] ~[{%s|}(%d)~] ~[{%s|}(%d) %w~] (%w)

#IF (%10 = "Sutex") {Sutex.hp = %1;Sutex.maxhp = %2;Sutex.ma = %3;Sutex.maxma = %4}
#IF (%10 = "Halix") {Halix.hp = %1;Halix.maxhp = %2;Halix.ma = %3;Halix.maxma = %4}
#IF (%10 = "Zarlix") {Zarlix.hp = %1;Zarlix.maxhp = %2;Zarlix.ma = %3;Zarlix.maxma = %4}
#IF (%10 = "Karlix") {Karlix.hp = %1;Karlix.maxhp = %2;Karlix.ma = %3;Karlix.maxma = %4}

The above trigger. Sets up a data based Variables Sutex, Halix, Zarlix, Karlix, in the 'Everyone.pkg.


Then My prompt displayed (%d)hp (%d)m (%d)mv > is in each Charterers .pkg * not shared*, and uses the HP and ma, *current vaules* for my buttons health mana bars on my status bar

All this works really well.
_________________
Entropy rules
Reply with quote
shalimar
GURU


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

PostPosted: Mon Mar 22, 2021 12:38 pm   
 
The trigger defining the variables could/should be in the shared package.
Just don't put variables you expect to update in a shared package, or everyone is trying to overwrite the shared data instead of making local data.
New variables are always defined in the root directory of the local session/window.
_________________
Discord: Shalimarwildcat
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Mon Mar 22, 2021 12:41 pm   
 
ok; thanks :)
_________________
Entropy rules
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Mon Mar 22, 2021 11:00 pm   
 
shalimar wrote:


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

In the same vein
%db( @{%window}, Sutex.hp)
should be
%db( @{%window}, hp)
because %window -IS- Sutex, you are trying to reference an @sutex.sutex.hp

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



Is the above meant to be in Everyone.pkg. (all the Characters see) where the prompt would be also?

Is the reason I had Sutex.hp, that Database variable and all the other Characters Database variable are in the Everyone.pkg

The Everyone.pkg showing, the Group trigger. The greyed out prompt, the one, this post is trying to get working. Next image shows that prompt .


The prompt which all Characters have in their .pkg

[/img]


All Characters PKG set up like Sutex. The Everyone tab, only the Everyone.pkg itself is checked. Same with Eternal Darkness which holds my Chat windows


What it all looks like
_________________
Entropy rules
Reply with quote
shalimar
GURU


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

PostPosted: Tue Mar 23, 2021 3:29 am   
 
For the purpose of sharing vitals, it has to be in the shared package.
My @groupstats example was just trying to avoid the awkwardness of @{%window}.
_________________
Discord: Shalimarwildcat
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Tue Mar 23, 2021 6:32 am   
 
This may be one of those things where DOCUMENTATION would be worthwhile. Should we get up a petition? Should we call the Queen for more paperwork?

However, I think, in the ADVANCED settings for the window/package, if you add the packages (accessible to other windows/packages) where the data is located it seems like that should do it...or you could qualify the data with the parent class of the variables.

I discovered that thing with %dbvar and gauges....it the same for buttons... because the data is not updated until you either click the button...or, if you go to the editor, click on the dbvar so that it gets updated.
Reply with quote
shalimar
GURU


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

PostPosted: Wed Mar 24, 2021 5:17 am   
 
I did mention on at least one of these threads that @dbVars don't play nice with gauges (which are technically buttons).
But it's also a simple fix (relatively).
Set the buttons/gauges to use a static variable (@hp, @hpMax, etc).
Then edit your prompt trigger to save the data to both the local session variables and the shared session @dbVar, for the odd situation when that is needed.
_________________
Discord: Shalimarwildcat
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Wed Mar 24, 2021 6:15 am   Update
 
shalimar wrote:
I did mention on at least one of these threads that @dbVars don't play nice with gauges (which are technically buttons).
But it's also a simple fix (relatively).
Set the buttons/gauges to use a static variable (@hp, @hpMax, etc).
Then edit your prompt trigger to save the data to both the local session variables and the shared session @dbVar, for the odd situation when that is needed.


Had no issues,@dbVars don't play nice with gauges below is working well.
Now the One prompt to rule them all! and the code above is meant to use these already set up variables the gauges below use.

The idea, each individual Characters.pkg normal prompt would be deleted. And the normal prompt would then be placed in the Everyone.pkg so all Characters can see it.
Then the One prompt to rule them all! can update the #SHOW send it Group chat if anyone about to die.
And the same normal prompt in the Everyone.pkg would update the variables gauges below and they would still work.

CURRENT SETUP

StatusEnergyHealthBar This uses my normal prompt (%d)hp (%d)m (%d)mv (%d)Arcana> (updated it yesterday to include Energy the last %d )
And this goes in each Characters .pkg (not seen by each other)

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="Status Bar">
    <button name="Health" type="Gauge" autosize="false" width="290" height="12" autopos="false" top="0" toolbar="2" image="HEART" color="green" textcolor="olive" gaugelowcol="red" gaugebackcol="aqua" priority="86">
      <value>zgh;
zre @tank;
zre @leader;</value>
      <expr>@Sutex.hp</expr>
      <gaugemax>@Sutex.maxhp</gaugemax>
      <gaugelow>@Sutex.maxhp/4</gaugelow>
    </button>
    <var name="heal_member" type="Literal">Sutex</var>
    <trigger priority="1580" newline="false" prompt="true" enabled="false">
      <pattern>(%d)hp (%d)m (%d)mv ></pattern>
      <value>:SUTEX:SUTEX.hp = %1
:SUTEX:SUTEX.ma = %2
:SUTEX:SUTEX.mv = %3</value>
    </trigger>
    <trigger priority="21880">
      <pattern>(%d)hp (%d)m (%d)mv (%d)Arcana></pattern>
      <value>:SUTEX:SUTEX.hp = %1
:SUTEX:SUTEX.ma = %2
:SUTEX:SUTEX.mv = %3
:SUTEX:SUTEX.en = %4</value>
    </trigger>
    <button name="Energy" type="Gauge" autosize="false" width="290" height="12" autopos="false" left="2" top="12" toolbar="2" image="BULBON" color="green" textcolor="olive" gaugelowcol="red" gaugebackcol="aqua" priority="83">
      <expr>@Sutex.en</expr>
      <gaugemax>@Sutex.maxen</gaugemax>
      <gaugelow>@Sutex.maxen/4</gaugelow>
    </button>
  </class>
</cmud>



EveryoneStatBar Is seen by all Characters, as it's place in the Everyone.pkg
This uses my group prompt I have type group first. This is where the @dbVar are stored written to and read.
~[{%s|}(%d)~/(%d){%s|}~]~[{%s|}(%d)~/(%d){%s|}~]~[{%s|}(%d)~/(%d){%s|}~] ~[{%s|}(%n)~] ~[{%s|}(%d)~] ~[{%s|}(%d) %w~] (%w)
.

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="Status Bar">
    <var name="Zarlix" type="Record">
      <value>maxen=10000|hp=5228|maxhp=5228|ma=5902|maxma=5902|mv=1306|en=10000</value>
      <json>{"maxma":5902,"maxhp":5228,"maxen":10000,"mv":1306,"ma":5902,"hp":5228,"en":10000}</json>
    </var>
    <var name="Sutex" type="Record">
      <value>maxen=10000|hp=6321|maxhp=6321|ma=5672|maxma=5672|mv=2453|en=10000</value>
      <json>{"maxma":5672,"maxhp":6321,"maxen":10000,"mv":2453,"ma":5672,"hp":6321,"en":10000}</json>
    </var>
    <var name="Halix" type="Record">
      <value>maxen=10000|hp=7028|maxhp=7028|ma=5100|maxma=5100|mv=1204|en=10000</value>
      <json>{"maxma":5100,"maxhp":7028,"maxen":10000,"mv":1204,"ma":5100,"hp":7028,"en":10000}</json>
    </var>
    <trigger priority="1590">
      <pattern>~[{%s|}(%d)~/(%d){%s|}~]~[{%s|}(%d)~/(%d){%s|}~]~[{%s|}(%d)~/(%d){%s|}~] ~[{%s|}(%n)~] ~[{%s|}(%d)~] ~[{%s|}(%d) %w~] (%w)</pattern>
      <value>#IF (%10 = "Sutex") {Sutex.hp = %1;Sutex.maxhp = %2;Sutex.ma = %3;Sutex.maxma = %4}
#IF (%10 = "Halix") {Halix.hp = %1;Halix.maxhp = %2;Halix.ma = %3;Halix.maxma = %4}
#IF (%10 = "Zarlix") {Zarlix.hp = %1;Zarlix.maxhp = %2;Zarlix.ma = %3;Zarlix.maxma = %4}
#IF (%10 = "Karlix") {Karlix.hp = %1;Karlix.maxhp = %2;Karlix.ma = %3;Karlix.maxma = %4}</value>
    </trigger>
    <button type="Gauge" autopos="false" left="656" toolbar="2" iconleft="false" color="#33CCCC" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1960">
      <caption>Karlix Hp</caption>
      <expr>@Karlix.hp</expr>
      <gaugemax>@Karlix.maxhp</gaugemax>
      <gaugelow>@Karlix.maxhp/5</gaugelow>
    </button>
    <button type="Gauge" autopos="false" left="416" toolbar="2" iconleft="false" color="fuchsia" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1936">
      <caption>Halix Hp</caption>
      <expr>@Halix.hp</expr>
      <gaugemax>@Halix.maxhp</gaugemax>
      <gaugelow>@Halix.maxhp/4</gaugelow>
    </button>
    <button type="Gauge" autopos="false" left="417" top="13" toolbar="2" iconleft="false" color="fuchsia" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1942">
      <caption>Halix Ma</caption>
      <expr>@Halix.ma</expr>
      <gaugemax>@Halix.maxma</gaugemax>
      <gaugelow>@Halix.maxma/5</gaugelow>
    </button>
    <button type="Gauge" autopos="false" left="297" top="0" toolbar="2" iconleft="false" color="lime" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1891">
      <caption>Sutex Hp</caption>
      <expr>@Sutex.hp</expr>
      <gaugemax>@Sutex.maxhp</gaugemax>
      <gaugelow>@Sutex.maxhp/4</gaugelow>
    </button>
    <button type="Gauge" autopos="false" left="297" top="12" toolbar="2" iconleft="false" color="lime" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1930">
      <caption>Sutex Ma</caption>
      <expr>@Sutex.ma</expr>
      <gaugemax>@Sutex.maxma</gaugemax>
      <gaugelow>@Sutex.maxma/5</gaugelow>
    </button>
    <button type="Gauge" autopos="false" left="536" top="2" toolbar="2" iconleft="false" color="#FF6600" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1947">
      <caption>Zarlix Hp</caption>
      <expr>@Zarlix.hp</expr>
      <gaugemax>@Zarlix.maxhp</gaugemax>
      <gaugelow>@Zarlix.maxhp/4</gaugelow>
    </button>
    <button type="Gauge" autopos="false" left="536" top="13" toolbar="2" iconleft="false" color="#FF6600" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1952">
      <caption>Zarlix Ma</caption>
      <expr>@Zarlix.ma</expr>
      <gaugemax>@Zarlix.maxma</gaugemax>
      <gaugelow>@Zarlix.maxma/4</gaugelow>
    </button>
    <trigger name="Advancement" priority="1600">
      <pattern>~[ (%w) advanced to level %d ~]</pattern>
      <value>#T- Advancement
#IF (%1 != "Sutex" | %1 !=  "Halix" | %1 != "Zarlix") {#GA}
#T+ Advancement</value>
    </trigger>
    <button type="Gauge" autopos="false" left="656" top="13" toolbar="2" iconleft="false" color="#33CCCC" gaugelowcol="red" gaugebackcol="#E4E4E4" priority="1958">
      <caption>Karlix Ma</caption>
      <expr>@Karlix.ma</expr>
      <gaugemax>@Karlix.maxma</gaugemax>
      <gaugelow>@Karlix.maxma/5</gaugelow>
    </button>
    <var name="Karlix" type="Record">
      <value>maxen=10000|hp=1036|ma=1271|mv=1285|en=10000|maxhp=1036|maxma=1271</value>
      <json>{"maxma":1271,"maxhp":1036,"maxen":10000,"mv":1285,"ma":1271,"hp":1036,"en":10000}</json>
    </var>
  </class>
</cmud>
_________________
Entropy rules
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