Virtual Variables

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3341
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Virtual Variables

#1

Post by Lobby » Wed Jan 31, 2018 23:23

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):
Show
roadAutoJoin
0 or 1
Determines whether placed road connects automatically to neighboring roads (game wide). You should set it back to it's original value after using it.
Show
winter
0, 1 or 2
Can be used to control winter (game wide).
0 = auto
1 = on
2 = off
Show
weatherTime
integer
Can be used to control weather. See here for more information.
Show
weatherFog
0 or 1
Can be used to enable (1) or disable fog (0).
Show
weatherLocked
0 or 1
Can be use to lock (1) or unlock (0) weather timer.
Show
WEATHER_NORMAL
integer constant 0
New cities will start with this weather time.
Show
WEATHER_SUNNY
integer constant 290373
This weather time will lead to sunny weather.
Show
WEATHER_RAIN
integer constant 849711
This weather time will lead to rainy weather.
Show
WEATHER_LIGHTNING
integer constant 622697
This weather time will lead to lightning.
Show
day
integer
Absolute day of the current date.
Show
cityRotation
0, 1, 2, 3
Rotation of the city. Default rotation is 0. Higher numbers mean 90 degree clock-wise rotation of the map.
Show
buildingCount
integer, only readable
Number of buildings in the city.
Show
roadCount
integer, only readable
Number of roads in the city.
Show
wireCount
integer, only readable
Number of wires in the city.
Show
pipeCount
integer, only readable
Number of pipes in the city.
Show
disaster
0 or 1
Is 1 if a disaster is currently active.
Show
music
0 or 1
Current setting for background music (on=1 or off=0).
Show
isDeveloper
0 or 1, only readable
Is 1 iff running in a developer build.
Show
demand_XY
integer, only readable
Demand for res/com/ind for specific level.
Possible values for X: res, com, ind
Possible values for Y: 0, 1, 2
For example to read demand for level II commerical you would use variable demand_com1. demand_XY contains the offset that is given by demand_XY_offset.
Show
demand_XY_offset
integer
Modifyable offset for demand. For XY see explanation of demand_XY.
...Have a nice stay

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

Platform

Plugin Creator

Re: Virtual Variables

#2

Post by CommanderABab » Wed Jan 31, 2018 23:30

Which ones of those are writeable?
754!754Currently using beta 754. 754 What's new? :)
harder hard mode!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Lobby
Developer
Reactions:
Posts: 3341
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: Virtual Variables

#3

Post by Lobby » Wed Jan 31, 2018 23:32

Any except those which are written in capital letters :)
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3341
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: Virtual Variables

#4

Post by Lobby » Sat Mar 10, 2018 15:27

Added variables to count buildings, roads, wires and pipes :mine
...Have a nice stay

User avatar
JustAnyone
Junior Developer
Reactions:
Posts: 2606
Joined: Sun Jul 23, 2017 12:45
Location: No idea either
Plugins: Show

Plugin Creator

Platform

Re: Virtual Variables

#5

Post by JustAnyone » Mon Apr 30, 2018 18:23

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 Continent
Reactions:
Posts: 1243
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Platform

Plugin Creator

Re: Virtual Variables

#6

Post by cesareborgia94 » Wed May 23, 2018 14:05

What is the name of virtual variable for setting music in the recent update 1.478?
Can anyone help elaborate?
:bt
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

cesareborgia94
Inhabitant of a Continent
Reactions:
Posts: 1243
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Platform

Plugin Creator

Re: Virtual Variables

#7

Post by cesareborgia94 » Wed Jul 04, 2018 19:13

[mention]Lobby[/mention]
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 Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

User avatar
Lobby
Developer
Reactions:
Posts: 3341
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: Virtual Variables

#8

Post by Lobby » Wed Jul 04, 2018 19:51

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"}]
By the way in recent versions you could write instead:

Code: Select all

"actions":["music=0"]
It means exactly the same thing.
...Have a nice stay

cesareborgia94
Inhabitant of a Continent
Reactions:
Posts: 1243
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Platform

Plugin Creator

Re: Virtual Variables

#9

Post by cesareborgia94 » Wed Jul 04, 2018 20:18

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 Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

Post Reply Previous topicNext topic

Return to “Fun attribute”

Who is online

Users browsing this forum: No registered users and 1 guest