How do 'flags' work?

So, how do they work exactly, and how are they defined? I don’t think they’re included in JavaScript. I have something regarding mods on my mind.

I explained it in one of our previous messages! You said you understood.

Are you actually going into the code and learning it?

Anyway, flags are data saved in savefiles. As example, if you wanted to store how many snails there were outside you would write

GDT.getDataStore("myMod").snailCount = getSnails();

And to use it

alert(GDT.getDataStore("myMod").snailCount);
2 Likes

Not these flags. I mean flags like, flags.grid the game has, to name an example. They do some stuff, but I can’t give the code away like that.

what are you asking here exactly?

1 Like

How does setFlag, work. For example, there’s this part: notification.setFlag("contractsEnabled", true);
It sets a flag, with a true value. the flag contractsEnabled is used somewhere else. That’s what I meant. Why are they used and what are its purposes/functions

In your specific example this just sets the flag contractsEnabled to true on the company after the specific notification is shown (as opposed to when we actually create the notification).

However, you shouldn’t have to use any of these flags to store any mod-specific data, that’s what GDT.getDataStore() is for.

Are you trying to achieve anything specific or is this just curiosity?

1 Like

I wanted to learn what they do. If you can set a value with setFlag (name, true/false) and use it on a return value, and when the specified flag is true, it executes the rest of the code. If that’s one of it’s property, I had something in my mind.

you shouldn’t use this.

use the mod API data store, it’s designed for mods.

Real question. Can someone add consolePart to GDT.addResearchItem? it works just fine, but the api wiki doesn’t include it.

Does dataStore have the same properties as flags?

why don’t you just take a bit of time to read the manual.

if it works just fine, then yes.

1 Like

It does, reading the manual now.

Also happens with group: “group”

You hang them on a pole and they represent your country. :slight_smile:

3 Likes

Oh yeah. Useful.