|
Padarom Newbie
Joined: 20 Apr 2022 Posts: 4
|
Posted: 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. |
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: 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 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4689 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
Padarom Newbie
Joined: 20 Apr 2022 Posts: 4
|
Posted: 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? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4689 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: 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. |
|
|
|
gawen Newbie
Joined: 15 Dec 2012 Posts: 8
|
Posted: 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> |
|
|
|
maxxwell.sana Newbie
Joined: 13 Jun 2022 Posts: 1
|
Posted: 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.
|
|
|
|
|
|