Page 1 of 1

Weather manipulation

Posted: 27 Jan 2018, 13:46
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.

Re: Weather manipulation

Posted: 27 Jan 2018, 16:50
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.

Re: Weather manipulation

Posted: 27 Jan 2018, 16:57
by JustAnyone
Are you sure this is the right topic? Dang you beat me to that.

Re: Weather manipulation

Posted: 27 Jan 2018, 16:59
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!

Re: Weather manipulation

Posted: 17 Oct 2023, 00:53
by Mortza
من تازه واردان کسی راهنمایی میکنه