Weather manipulation

Any information about the fun attribute is given here.

Moderator: FranchuFranchu

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

Weather manipulation

Post by Lobby » Sat Jan 27, 2018 13:46

Since variables are available it's possible to change weather using something called virtual variables. Virtual variables are variables that are used by the game internally and are exposed for use in fun.

Weather in TheoTown has an internal time (in milliseconds) that is used to calculate the current weather (based on a mystic formula :bd ). You can assign a new time for weather by writing a value into a variable called "weatherTime" :json

Code: Select all

    "on click fun":[
      {"actions":[{"type":"set","id":"weatherTime","code":"0"}]}
    ]
So this code sets weather time back to 0. Here more useful numbers:
  • Sunny: 290373
  • Rain: 849711
  • Lightning: 622697
To enable/disable fog, write a value of 1/0 to a variable called "weatherFog".
To lock/unlock the weather timer, write a value of 1/0 to a variable called "weatherLocked". That's how the weather machine preserves the selected weather.

You can also read from these virtual variables.
...Have a nice stay

User avatar
Matison55557
Inhabitant of a Universe
Reactions:
Posts: 4710
Joined: Mon Jul 04, 2016 18:49
Location: Poland
Plugins: Show
Version: Beta
Phone: Huawei P9 lite mini

Re: Weather manipulation

Post by Matison55557 » Sat Jan 27, 2018 15:35

Nice!
Ghoughpteighbteau tchoghs.

Developing a text-based city builder for pc. :mine

Help. Ants all over me. 🐜

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5734
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Weather manipulation

Post by CommanderABab » Sat Jan 27, 2018 16:50

Code: Select all

  {...,
     "on click fun":[
        {"actions":[{"type":"set","id":"weatherTime","code":622697}]},
        {"actions":[{"type":"remove","x":-1,"y":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"remove","x":-1,"y":-1}],"always":true,"ignore success":true},
        {"actions":[{"type":"remove","x":0,"y":-1}],"always":true,"ignore success":true},
        {"actions":[{"type":"remove","x":1,"y":-1}],"always":true,"ignore success":true},
        {"actions":[{"type":"remove","x":1,"y":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"remove","x":1,"y":1}],"always":true,"ignore success":true},
        {"actions":[{"type":"remove","x":0,"y":1}],"always":true,"ignore success":true},
        {"actions":[{"type":"remove","x":-1,"y":1}],"always":true,"ignore success":true},
        
        {"actions":[{"type":"build","x":-1,"y":0,"id":"$road00","level":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"build","x":-1,"y":-1,"id":"$road00","level":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"build","x":0,"y":-1,"id":"$road00","level":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"build","x":1,"y":-1,"id":"$road00","level":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"build","x":1,"y":0,"id":"$road00","level":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"build","x":1,"y":1,"id":"$road00","level":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"build","x":0,"y":1,"id":"$road00","level":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"build","x":-1,"y":1,"id":"$road00","level":0}],"always":true,"ignore success":true},
        
       
        
        {"actions":[{"type":"set","id":"weatherTime","code":290373}]},
        {"actions":[{"type":"remove"}],"always":true,"ignore success":true},
       
        {"actions":[{"type":"set","id":"weatherLocked","code":0}]}
        
        
      ]         
  },
  ...
Pertinent snippet of code. :)

Should build a dirt or country road roundabout and remove the 1x1 that was clicked.
492492Currently using 492. 492 What's new? :)
find building!
:)

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

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 1982
Joined: Sun Jul 23, 2017 12:45
Location: TheoTown command centre
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: Weather manipulation

Post by JustAnyone » Sat Jan 27, 2018 16:57

Are you sure this is the right topic? Dang you beat me to that.
Founder and owner of DSA
TheoTown discord manager
Developer of Plugin Creator Application.

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5734
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Weather manipulation

Post by CommanderABab » Sat Jan 27, 2018 16:59

JustAnyone wrote:
Sat Jan 27, 2018 16:57
Are you sure this is the right topic? Dang you beat me to that.
Yes, it changes the weather!
492492Currently using 492. 492 What's new? :)
find building!
:)

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

Post Reply

Return to “Fun attribute”

Who is online

Users browsing this forum: No registered users and 1 guest