CraftBook 3

CraftBook 3

139k Downloads

Make Variables Private as opposed to Public

LadyCailinBot opened this issue ยท 10 comments

commented

CRAFTBOOK-2617 - Reported by cadika_orade

Concept:
While I love the idea of variables, I think they would be somewhat more useful if they could be made private to the player who declares them.

Implementation:
Essentially, an additional optional argument at the end of "/cb var define" that flags a variable such that they can only be changed by the player who defined them. Ideally, these variables could only be used on signs by the player who defined them, allowing players to re-use variable names without conflict so long as they are declared as private. Unfortunately, I cannot fathom how that could be implemented.

Justification:
When I first found variables, my immediate thought had been to use them to set the offset values for my Timebomb-based nuclear device that has every other faction on my server trembling in fear. The only thing stopping me at this point is the fear that the variable names could be discovered by an enemy and reset to target my city instead. Faction politics aside, variables could be more useful to players if they have some measure of security.

Note: Sorry this is marked as CommandBook. It doesn't allow me to change it to CraftBook.

commented

Comment by cadika_orade

Shucks. I'm glad to see it added, but namespaces might pose an issue. One of my moderators has a username 15 letters long, which breaks namespaces.

commented

Comment by me4502

Thats why I added namespaces instead of enforcing player names. Basically, you can provide them with a custom namespace to use.

commented

Comment by me4502

Okay, I've added .self permissions for namespaces.

commented

Comment by me4502

Build 2317 has a stable working version of Namespace Variables.

commented

Comment by me4502

This was my initial intention when making variables. I then ran into issues like, how would I store these? How would I reference them? I thought of %Name:Variable%, but that may be too long for some sign lines.

commented

Comment by pmpmpm

What about an ID for each player, stored in Players_ID.txt?

commented

Comment by me4502

That's a messy and complicated way

commented

Comment by pmpmpm

Then what about IDs defined by the admin (only numbers, such as 042 or 32723) with corresponding permission?
(" craftbook.id.# ")

commented

Comment by me4502

I find that way too messy and complex.

commented

Comment by me4502

Private variables have now been completed. They use a namespace system similar to ToggleAreas.