Weather manipulation

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3679
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Weather manipulation

#1

Post by Lobby »

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.
=^._.^= ∫

User avatar
CommanderABab
AB
Reactions:
Posts: 10597
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: Weather manipulation

#2

Post by CommanderABab »

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.

User avatar
JustAnyone
Developer
Reactions:
Posts: 3336
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: Weather manipulation

#3

Post by JustAnyone »

Are you sure this is the right topic? Dang you beat me to that.
:pickle:

User avatar
CommanderABab
AB
Reactions:
Posts: 10597
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: Weather manipulation

#4

Post by CommanderABab »

JustAnyone wrote:
27 Jan 2018, 16:57
Are you sure this is the right topic? Dang you beat me to that.
Yes, it changes the weather!

Post Reply Previous topicNext topic

Return to “Fun attribute”