Weather manipulation

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3538
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
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: 8647
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
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.
Image

User avatar
JustAnyone
enjenir
Reactions:
Posts: 2924
Joined: Sun Jul 23, 2017 12:45
Location: Easter Island
Plugins: Show

Re: Weather manipulation

#3

Post by JustAnyone »

Are you sure this is the right topic? Dang you beat me to that.
Perfect way to comment stuff out :)
🦀Now available as administrator🦀
Image

:pickle:

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

Platform

Plugin Creator

Re: Weather manipulation

#4

Post by CommanderABab »

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!
Image

Post Reply Previous topicNext topic

Return to “Fun attribute”