Global Variables reset after each test client

Started by Kylebutter123 on

Topic category: Help with modding (Java Edition)

Last seen on 01:51, 7. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Global Variables reset after each test client
Fri, 08/09/2019 - 17:56 (edited)

I think i wrote the NBT read and write code correctly so the variable saves when i save and quit the world and rejoin..

But if i close the client and reopen it it resets the variable entirely. I saw that the code was resetting the variable back to 0 each time but i have no idea how to remove that. 

Any help with this problem now?

Edited by Kylebutter123 on Fri, 08/09/2019 - 17:56
This happens because you are…
Fri, 08/09/2019 - 09:37

This happens because you are using GLOBAL_SESSION which is only persistent per session.

Last seen on 01:51, 7. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried using the other…
Fri, 08/09/2019 - 17:53

I tried using the other variable scopes but now it doesnt save at all when i exit and rejoin my world.

 

Last seen on 01:51, 7. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
On block right click which…
Sat, 08/10/2019 - 15:29

On block right click which adds 1 to the variable each time i right click the block

 

Where do you read the value…
Sat, 08/10/2019 - 16:21

Where do you read the value of this variable after you set it? By where, I mean how is the procedure which reads this value triggered?

Last seen on 01:51, 7. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i have a gui that also opens…
Sun, 08/11/2019 - 01:10

i have a gui that also opens when I right click the block which helps me track how much i right clicked the block.

Last seen on 01:51, 7. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i show to value of the…
Sun, 08/11/2019 - 17:54

i show to value of the variaible on the top of the gui

GUI works on the client side…
Mon, 08/12/2019 - 05:26

GUI works on the client side, while global map and world variables work on server side. I will make a wiki page explaining this soon. What you need to do is set global map/world variable in the procedure like you do now, but then copy the value of global map variable by getting its value and set global session variable to its value. Global session variables work on the client side too and can be then used in GUIs for display.

Last seen on 01:51, 7. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This worked extremely well!…
Mon, 08/12/2019 - 15:08

This worked extremely well! Thanks Klemen