One Million Worlds Wiki
Explore
Main Page
All Pages
Interactive Maps
navigation
Main page
Community portal
Recent changes
Random page
Admin noticeboard
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
One Million Worlds Wiki
78
pages
Explore
Main Page
All Pages
Interactive Maps
navigation
Main page
Community portal
Recent changes
Random page
Admin noticeboard
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
Editing
Script Block
(section)
Back to page
Edit
VisualEditor
History
Talk (0)
Edit Page
Script Block
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Remembering things from the last time the script was run == Usually the script runs a fresh each time, forgetting all its variables, but it is possible to remember things from run to run, this is done using the persistent (or p) scope. Also because I really struggle to spell persistent you can also use the persist'''a'''nt scope and that will work fine. Anything in the persistent scope will still be available the next time the script runs. So lets say we want to modify the “go away” script from the “asking questions” section so that if starts saying go away if you come within 5 meters but then it keeps saying it until you are 10 meters away: <pre>if(firstRun){ p.goAway = false //when the script first starts up default to not saying anything } if(W<5){ p.goAway = true } if(W>10){ p.goAway = false } //note that if W is between 5 and 10 it is left at whatever value it had previously if(p.goAway){ N = 'Go away!' } </pre>
Summary:
Please note that all contributions to the One Million Worlds Wiki are considered to be released under the CC BY-NC-SA
Cancel
Editing help
(opens in new window)
Follow on IG
TikTok
Join Fan Lab