About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Carpesimia
Newbie


Joined: 06 Feb 2025
Posts: 8

PostPosted: Thu Feb 06, 2025 8:15 pm   

Guage problems
 
Ok, so here's the set-up:

I have a specific package for each mud i frequent. I add this package to each character on a given mud, so all my triggers/aliases/etc are in one place for editing purposes. I am now working at getting the info from my prompt into gauges, and I am running into issues.

So, I have some gauges. Lets keep it simple and say I have one. This is it:

Quote:
<button name="hp" type="Gauge" autosize="false" width="125" height="35" toolbar="2" inset="true" toolstyle="true" color="#00B300" gaugelowcol="red" gaugebackcol="silver" priority="200" id="56">
<caption>HP @pHp / @pMaxhp</caption>
<value>@pHp</value>
<expr>@pHp</expr>
<gaugemax>@pMaxhp</gaugemax>
<gaugelow>@pMaxhp/10</gaugelow>
</button>


Now, this is paired with a trigger. The trigger looks for the prompt, and sets the values used by the gauge. In simple terms, this:


Quote:
#VA pHp 1
#VA pMaxhp 2


So, here's my situation:

If the gauges load on the screen before the trigger hits for the first time AND the variables dont exist, cmud locks up. Dead. Meaning, it shows the "edit" cursor, and nothing is clickable in any windows. I cannot even close it, I need to kill the session with the task manager.

So, I was like hey, let me try manually adding the variables to the characters package. This works PERFECTLY. But, I sometimes create alts on the fly for quick different purposes, and connecting, turning off triggers, manually adding 6 vars can be a bit of a pain. and if I forget, BAM complete lock up.

So, I tried adding these as vars in the shared lib. This works also. Sort of. For any alt that also has the vars, its great. But for alts that dont already have the vars, it uses the shared vars with multiple windows open. Which means the buttons have the wrong amounts.

So... thoughts on what I can do here? I cant seem to get the "shared" package to create a variable in the default session package, unless the variable doesnt exist in the shared package. And if the variable in the shared package doesnt exist when the buttons are rendered, then trying to set a value to a var used by the gauge locks up cmud. I even tried an event and, on connect, create the variables i want. Nope, didnt work.

I'm using the latest cmud pro. Has anyone seen this? Does anyone have a suggestion?[/quote]
Reply with quote
Carpesimia
Newbie


Joined: 06 Feb 2025
Posts: 8

PostPosted: Thu Feb 06, 2025 9:29 pm   
 
Ok, so I figured it out. Well, I figured one way out.

So, I put the gauges in a class all their own, in my shared package.
I deleted the variables out of the shared package.
I moved my prompt trigger into a different class in the shared package.

Then I modified the shared trigger to do this:

Quote:


#VA hasAlreadyRun %defined(alreadyRun)

if (@hasAlreadyRun=0) {
#T- bottomGauges
}

#VA php %1
#VA phpmax %2
...
...
#VA lastvar %5

if (@hasAlreadyRun=0) {
#T+ bottomGauges
#TEMPVAR alreadyRun 1
}



So, using a temporary var, I see if this is the first time the trigger has been activated this session. If it has, I turn off the guages. I then set the vars. And, again, if this was the first time through I re-enable the gauges and set my temp var to 1.

Is it the most elegant way? Probably not. Does it do the job? Yup. And, I chose to use a separate variable to check if its run because the actual stat vars may or may not exist in any combinations, so decided to take that worry out of the equation.

Anyways, hope this helps someone. Would be interested if anyone has a better way, or if I missed a setting somewhere.
Reply with quote
shalimar
GURU


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

PostPosted: Fri Feb 07, 2025 12:08 pm   
 
I have never had lock up issues over a gauge in a shared package having variables in the default package.
I just make sure that any triggers that populate the variables are also in the shared package.

Though i can see a divide by zero error when the null values evaluate to 0.

Glad you got it working though.
_________________
Discord: Shalimarwildcat
Reply with quote
Carpesimia
Newbie


Joined: 06 Feb 2025
Posts: 8

PostPosted: Sat Feb 08, 2025 3:34 am   
 
The issue wasnt about where the vars were, its about them not existing. I wanted the vars in the default package, since they would remain per-user. The issue is the gauges would be initialized before the vars existed. And the lockup happened the first time i tried to write to the variables. Unless i disabled the gauges first.
Reply with quote
shalimar
GURU


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

PostPosted: Sat Feb 08, 2025 12:35 pm   
 
Right, I understand what you mean.
I use the same setup for one of my gauge packages, only I don't include the /max in my caption.
Given that the caption does get evaluated, this might be the source of the /0 error that I suspect is your culprit.
Null evaluates to 0 when CMUD expects a number

For Comparison:
Code:
<button type="Gauge" variable="@hp" autosize="false" width="200" height="23" autopos="false" left="0" top="-1" toolbar="2" color="fuchsia" gaugelowcol="red" gaugebackcol="#F0F0F0" priority="280" id="21">
  <caption>Health: @hp</caption>
  <value>score</value>
  <expr>@hp</expr>
  <gaugemax>@hpMax</gaugemax>
  <gaugelow>@hpMax/4</gaugelow>
</button>
_________________
Discord: Shalimarwildcat
Reply with quote
Carpesimia
Newbie


Joined: 06 Feb 2025
Posts: 8

PostPosted: Sat Feb 08, 2025 8:29 pm   
 
Regardless, appreciate your input. Gives me some insight into whats going on going forward when I get more creative with my scripting.
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 197

PostPosted: Sun Feb 16, 2025 6:51 pm   
 
there's another post about this issue, the variables were never meant to be store like that so they sometimes get disappeared from cmud's memory file. the workaroud i found was to simple delete the button, and remake it.
it's not great but its what worked for me.
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