## Virtual Variables

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

Lobby
Developer
Reactions:
Posts: 3640
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

### Virtual Variables

Virtual variables are variables that are used by the game internally and are exposed for use in fun. See here to learn more about variables in general. Unlike user defined variables virtual variables don't have to be read- and writeable at the same time. It's not defined what happens if you try to read a non readable virtual variable. If you try to set a non-writeable virtual variable nothing will happen.

Virtual variables (constants are written in CAPITAL LETTERS):
winter
weatherTime
weatherFog
weatherLocked
WEATHER_NORMAL
WEATHER_SUNNY
WEATHER_RAIN
WEATHER_LIGHTNING
day
cityRotation
buildingCount
wireCount
pipeCount
disaster
music
demand_XY
demand_XY_offset
gameSpeed
gameMode
Last edited by Bearbear76 on Sun Oct 06, 2019 10:37, edited 2 times in total.
=^._.^= ∫

CommanderABab
AB
Reactions:
Posts: 9265
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

### Re: Virtual Variables

Which ones of those are writeable?

Lobby
Developer
Reactions:
Posts: 3640
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

### Re: Virtual Variables

Any except those which are written in capital letters
=^._.^= ∫

Lobby
Developer
Reactions:
Posts: 3640
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

### Re: Virtual Variables

=^._.^= ∫

JustAnyone
Rip-off engineer
Reactions:
Posts: 3113
Joined: Sun Jul 23, 2017 12:45
Location: Easter Island
Plugins: Show

### Re: Virtual Variables

Since version 471 a new variable was added called "gameSpeed"
It sets the speed in your city.
0 - pause
1 - slow
2 - normal
3 - fast
4 - ultra fast

cesareborgia94
Inhabitant of a Planet
Reactions:
Posts: 1306
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta

### Re: Virtual Variables

What is the name of virtual variable for setting music in the recent update 1.478?
Can anyone help elaborate?
I rarely make plugins now, but I still make them in spare time.
Disclaimer

cesareborgia94
Inhabitant of a Planet
Reactions:
Posts: 1306
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta

### Re: Virtual Variables

@Lobby
It may be too late to ask this,
but what does virtual variable involving "music" do in the game?

Also I don't mean to ask too much but how does a json code is used involving a virtual variable using music?

Thank you.
I rarely make plugins now, but I still make them in spare time.
Disclaimer

Lobby
Developer
Reactions:
Posts: 3640
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

### Re: Virtual Variables

You can use the virtual variable "music" to get/set the current setting for music. E.g. if you want to turn background music off you could execute:

Code: Select all

"actions":[{"type":"set","id":"music","code":"0"}]

Code: Select all

"actions":["music=0"]
It means exactly the same thing.
=^._.^= ∫

cesareborgia94
Inhabitant of a Planet
Reactions:
Posts: 1306
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta

### Re: Virtual Variables

Thank you Lobby for explaining.

I thought the music action is supposed to allow a plugin to pick a music from a library, but I guess I was wrong about that :/
Now I understand
I rarely make plugins now, but I still make them in spare time.
Disclaimer