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
Padarom
Newbie


Joined: 20 Apr 2022
Posts: 4

PostPosted: Sun May 15, 2022 3:51 pm   

Placing variables to the root
 
I am having issue with creating same variable in multiple places/classes.
As a result, things stop working due to multiples.

How to point to the root class/folder every time variable is being created/updated?

example:
<trigger priority="12490" id="1249">
<pattern>gold coins and find it to be (%d)</pattern>
<value>ccash = %1</value>
</trigger>

ccash gets created sometimes in root, sometimes in other class.
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 168

PostPosted: Sun May 15, 2022 7:54 pm   
 
Sadly this is an issue with my settings to... I find it does it more frequently when I am enabling/disabling classes that store said variables.

My solution was to migrate to DBVars " charData.Var_Name | HUD.Var_Name " the first half would match with the class it would have been stored in to keep things semi-organized, and after the . would be the variable to read/write to.

It's not hard but also not easy making the change. Mostly you just have to leave all your variables in the root directory.

What it is doing is writing the variable to last interacted with class as the 'active' folder
Reply with quote
shalimar
GURU


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

PostPosted: Sun May 15, 2022 8:02 pm   
 
You don't have to leave the variables at root, just don't store them in a class that gets disabled.

But to force a variable into a given class, use the full command:

#VAR ccash {%1} {} {ClassName}
_________________
Discord: Shalimarwildcat
Reply with quote
Padarom
Newbie


Joined: 20 Apr 2022
Posts: 4

PostPosted: Mon May 16, 2022 2:25 am   
 
shalimar, is there a command to save them in root?

What should I use as class name to make sure it ends up in the root?
Reply with quote
shalimar
GURU


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

PostPosted: Tue May 17, 2022 12:25 pm   
 
try:

#VAR /ccash {%1}
_________________
Discord: Shalimarwildcat

Last edited by shalimar on Tue May 17, 2022 12:31 pm; edited 1 time in total
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Tue May 17, 2022 12:26 pm   
 
For the simplest, safest way of updating/creating you should use a more-qualified method and specifying a class will guarantee the correct variable gets updated.

I just use

class/varName

which does work for me.

#var class/name

to create, and

class/var=value

to update. I qualify almost everything and by giving the parent class puts everything in the right place. It is also good practice to never repeat using the same class name or variable name. But, to be frank, I rarely create vars outside the editor. I am then certain they have been created where I want them and, subsequently, get correctly updated.
Reply with quote
gawen
Newbie


Joined: 15 Dec 2012
Posts: 8

PostPosted: Wed May 18, 2022 6:40 pm   
 
You can also try to use

#class 0

<trigger priority="12490" id="1249">
<pattern>gold coins and find it to be (%d)</pattern>
<value>#class 0; ccash = %1</value>
</trigger>
Reply with quote
maxxwell.sana
Newbie


Joined: 13 Jun 2022
Posts: 1

PostPosted: Mon Jun 13, 2022 10:47 am   
 
It's not hard but also not easy making the change. Mostly you just have to leave all your variables in the root directory.
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