Jump to content
  • 0

How to wipe 'mapreg' - Global Permanent Variables


Gouki

Question


  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.06
  • Content Count:  241
  • Reputation:   11
  • Joined:  08/12/20
  • Last Seen:  

Hi guys, I tried truncating my mapreg and values are still not removed, this is check when you @set "$variable" in game.

I tried checking the sql mapreg database also and it's empty, however there are values when checked in game. how do you delete this or wipe?

image.thumb.png.efb090049e86d5b5b0f1cd60e62e264a.png

 

image.png.23cd3ece4de907e84e2575a0c6f6a75d.png

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  661
  • Reputation:   670
  • Joined:  11/12/12
  • Last Seen:  

Long story short, you need to restart your server.

As for why... that is due to how SQL data is used on the map-server. When the map-server starts, it reads all the variables in the mapreg table and loads them into memory. This way, when you want to access the variable in-game (when you use @set $variable), the value is easily accessible without having to look it up with your SQL server. This is done for various other features, like your character inventory, quests, achievements, player stats, etc.

In either case, when you edit or delete the entry in SQL while it is still being loaded in memory, it will not have any impact in-game because that is not where the data is being read from. Doing so can actually cause issues as well if you're not careful. So you need to close your server, truncate the table, and then restart your server.

  • Upvote 1
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  926
  • Reputation:   168
  • Joined:  04/05/13
  • Last Seen:  

Make sure there are no new variable got re-registered again on OnInit / OnPCLoginEvent.

Edited by Start_
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.06
  • Content Count:  241
  • Reputation:   11
  • Joined:  08/12/20
  • Last Seen:  

Yes this specific variable is not triggered by oninit and onpcloginevent aswell. 

 

On 6/14/2022 at 8:59 AM, Tokei said:

Long story short, you need to restart your server.

As for why... that is due to how SQL data is used on the map-server. When the map-server starts, it reads all the variables in the mapreg table and loads them into memory. This way, when you want to access the variable in-game (when you use @set $variable), the value is easily accessible without having to look it up with your SQL server. This is done for various other features, like your character inventory, quests, achievements, player stats, etc.

In either case, when you edit or delete the entry in SQL while it is still being loaded in memory, it will not have any impact in-game because that is not where the data is being read from. Doing so can actually cause issues as well if you're not careful. So you need to close your server, truncate the table, and then restart your server.

Thank you for the perfect explanation, appreciate it @Tokei

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...