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


Joined: 26 Oct 2012
Posts: 56

PostPosted: Mon Apr 30, 2018 8:37 am   

Script creating new variable for no apparent reason..
 
I am running a script that keeps track of my health/mana as variables: @spperc and @hpperc.

I've been running it for weeks now with no issues, but now it has started to create a new variable
every so often for my @hpperc and @spperc and saves them in a different class folder.

This is a problem because I use an alarm trigger during combat to heal me when I drop below 50% health
And this results in me dying because for some reason it continues to change the new @hpperc but it calls on
the old one for my alarm trigger.

I deleted the new ones several times now but it keeps happening.

Has anyone had this problem or maybe as a hunch on what is going wrong?
_________________
It is better to die on your feet than to live on your knees.
Reply with quote
shalimar
GURU


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

PostPosted: Mon Apr 30, 2018 2:16 pm   
 
Is it possible that the class they are supposed to go in is ever disabled at the time of definition?
That would force a new copy to be made at root.

You could always use the long form variable definition and include class name.

#VAR someVar {100} _nodef {In|That|Class}
_________________
Discord: Shalimarwildcat
Reply with quote
MyMiasma
Wanderer


Joined: 26 Oct 2012
Posts: 56

PostPosted: Mon Apr 30, 2018 7:27 pm   
 
Thank you for your response.

My "healing" class folder is never disabled. And the new variables aren't being made in the root menu,
they are being made in the deepest class/folder that is currently being used. And it seems weird
that this wasn't a problem the first few weeks I ran the script and I hadn't touched a thing when it
started to happen.

I want to try the long form variable for both my trigger that captures my hp/sp and also
for my alarm trigger but even with your example below I am having trouble getting it to work.

<trigger priority="50" id="292">
<pattern>** HP: (%d)/(%d) SP: (%d)/(%d)</pattern>
<value>hpPerc=%eval( (%float( %1)/%2)*100)
spPerc=%eval( (%float( %3)/%4)*100)</value>
</trigger>

How would this look if I wanted to my @hpperc and spperc to save in "{healing}" folder/class?
_________________
It is better to die on your feet than to live on your knees.
Reply with quote
shalimar
GURU


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

PostPosted: Tue May 01, 2018 12:17 am   
 
#VAR hpPerc {%eval(%float( %1)/%2*100)} _nodef {healing}

Took out a redundant set of parenthesis as well.
There is no need to force this to happen in a special order, as it follows the standard order of operations anyway.
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


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

PostPosted: Tue May 01, 2018 12:23 am   
 
<trigger priority="50" id="292">
<pattern>** HP: (%d)/(%d) SP: (%d)/(%d)</pattern>
<value>#VAR hpPerc {%eval(%float(%1)/%2*100)} _nodef {Healing}
#VAR spPerc {%eval(%float(%3)/%4*100)} _nodef {Healing}</value>
</trigger>
_________________
Discord: Shalimarwildcat
Reply with quote
MyMiasma
Wanderer


Joined: 26 Oct 2012
Posts: 56

PostPosted: Tue May 01, 2018 7:38 pm   
 
Worked. :) thanks again Guru
_________________
It is better to die on your feet than to live on your knees.
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