This script, worldschedule.txt, changes world attributes at set times of the day. It requires, besides the script file itself, the following files in the same folder as the script file:
world=xelagon 5,dawn,xelagon_dawn.txt, 8 30,day,xelagon_day.txt, 19 15,dusk,xelagon_dusk.txt, 21,night,xelagon_night.txt, |
The files I used to test the bot are these (their names are the ones in blue in my file schedule.txt):
xelagon_dawn.txt
WelcomeMessage=Welcome to Xelagon :)~{newline}XelaG:{tab}This is my bot-studio at dawn Backdrop=softskydawn BackdropRed=92 BackdropGreen=92 BackdropBlue=92 |
xelagon_day.txt
WelcomeMessage=Welcome to Xelagon :)~{newline}XelaG:{tab}This is my bot-studio by day Backdrop=softskyday BackdropRed=255 BackdropGreen=255 BackdropBlue=92 |
xelagon_dusk.txt
WelcomeMessage=Welcome to Xelagon :)~{newline}XelaG:{tab}This is my bot-studio at dusk Backdrop=softskydusk BackdropRed=120 BackdropGreen=92 BackdropBlue=120 |
xelagon_night.txt
WelcomeMessage=Welcome to Xelagon :)~{newline}XelaG:{tab}This is my bot-studio by night Backdrop=softskynight BackdropRed=32 BackdropGreen=32 BackdropBlue=32 |
Notice the placeholders for a line break {newline} and for a TAB {tab}
NOTE: the above are only examples of attributes you may use. Do not use the above example files, make your own! Try to understand how this script works. Please don't email me that you don't use backdrops. If you don't need backdrops, don't put them in the files, put only those attributes you want to change. Notice also that BackdropRed, BackdropGreen and BackdropBlue are now called FogRed, FogGreen, FogBlue. The old names will still work with all versions.
The script below, which you must copy-paste into a text processor and save AS TEXT to a file (for example, call it WorldSchedule.txt), is an auto-run script: as soon as it is loaded, the bot starts executing it. When it starts, the script loads the file schedule.txt, remembers the times and filenames to use for each time. Copy-paste only the script file, do not copy-paste the above files as they are only examples, make your own with the world attributes you need to change.
The bot will check if it is in the right world (and right universe if you specify a universe), and change your world attributes to match what you specified for that time of the day.
WorldSchedule.txt (script file)
[Head] Type=Script Version=2.0 [Settings] Origin=0.000n 0.000w 0.00a 0.0° Run [Script] ################################### # The WorldSchedule Bot # # a Xelagot script # # (c) 2000 Alex Grigny de Castro # ################################### ################################################################## ###### Requires Xelagot 2.9999916 or higher ###### Help: www.imatowns.com/xelagot/xlgasex_worldschedule.html ################################################################## var $World, $Universe var /s_Schedule, $ScheduleFile var /s_Attrib var %Changes, %Pointer var %ok, %okSchedule, %FileNotFound var %okFiles, %okWorld, %HasUniverse, %okUniverse var %myWorld var !This, !Next var $This, $Next var $ThisFile, $NextFile var !now var $CRLF, $TAB Label Start $ScheduleFile = "schedule.txt" Concat $CRLF #13 #10 $TAB = #9 Gosub Initialize IfInt %FileNotFound <> 0 Goto Error IfInt %Changes = 0 Goto Error IfInt %okSchedule = 0 Goto Error IfInt %okFiles = 0 Goto Error # now the Pointer is set to the right period # change the attributes Label Main_Loop # check universe GetUniverse $u IfInt %HasUniverse = 0 %okUniverse = 1 Else IfString $u = $Universe %okUniverse = 1 Else %okUniverse = 0 IfInt %okUniverse = 0 Goto WrongWorld # check the world GetWorld $w IfString $w <> $World Goto WrongWorld IfNotLoginWorld Goto WrongWorld # check the time GetTime !now IfTime !now IsBetween !This !Next Gosub ChangeAttributes Goto Main_Loop Label WrongWorld GetUniverse $u IfInt %HasUniverse = 0 %okUniverse = 1 Else IfString $u = $Universe %okUniverse = 1 Else %okUniverse = 0 IfInt %okUniverse = 0 Goto WrongWorld GetWorld $w IfString $w = $World IfLoginWorld Goto Start Goto WrongWorld End Label Error IfInt %FileNotFound <> 0 SecretConcat "File " $ScheduleFile " not found IfInt %Changes = 0 SecretConcat "Invalid schedule file " $ScheduleFile IfInt %Changes = 0 SayConcat "Invalid schedule file " $ScheduleFile IfInt %okWorld = 0 SecretConcat "Missing world name in " $ScheduleFile IfInt %okWorld = 0 SayConcat "Missing world name in " $ScheduleFile IfInt %okSchedule = 0 SecretConcat "Error in schedule file " $ScheduleFile IfInt %okSchedule = 0 SayConcat "Error in schedule file " $ScheduleFile End Sub Initialize # set error flags to 'no error' %FileNotFound = 0 %Changes = 1 %okWorld = 1 %okSchedule = 1 %okFiles = 1 # load the schedule SListLoad /s_Schedule $ScheduleFile %FileNotFound IfInt %FileNotFound <> 0 EndSub # remove any empty lines SListNoBlanks /s_Schedule # world name must be included IfSListGetValue /s_Schedule "world" $World Else %okWorld = 0 IfInt %okWorld = 0 EndSub SListDeleteName /s_Schedule "world" # universe name is optional IfSListGetValue /s_Schedule "universe" $Universe %HasUniverse = 1 Else %HasUniverse = 0 SListDeleteName /s_Schedule "universe" # count how may changes SListGetCount /s_Schedule %Changes IfInt %Changes = 0 EndSub Gosub CheckSchedule IfInt %okSchedule = 0 EndSub Gosub CheckFiles IfInt %okFiles = 0 EndSub Gosub SetPointer EndSub Sub CheckSchedule %okSchedule = 1 %Pointer = 1 Label CheckSchedule_Loop IfInt %Pointer > %Changes EndSub Gosub GetThis Gosub GetNext IfTime !this IsAfter !next %okSchedule = 0 Inc %Pointer # last entry should not be checked against first IfInt %Pointer < %Changes IfInt %okSchedule = 1 Goto CheckSchedule_Loop EndSub Sub CheckFiles GetMyDir $q %okFiles = 1 %Pointer = 1 Label CheckFiles_Loop Gosub GetThis Concat $f $q $ThisFile IfFileExists $f Else Gosub NoFile Inc %Pointer IfInt %Pointer <= %Changes Goto CheckFiles_Loop EndSub Sub NoFile %okFiles = 0 SecretConcat "Attributes file " $ThisFile " not found" SayConcat "Attributes file " $ThisFile " not found" EndSub Sub SetPointer %ok = 0 %Pointer = 0 Label SetPointer_Loop Inc %Pointer IfInt %Pointer > %Changes %Pointer = 1 Gosub GetThis Gosub GetNext GetTime !now IfTime !now IsBetween !this !next %ok = 1 IfInt %ok = 0 Goto SetPointer_Loop EndSub Sub GetThis SItemGet /s_Schedule %Pointer $a Split $b $c $a "," GetTime !This $b Split $This $c $c "," Split $ThisFile $c $c "," EndSub Sub GetNext %p = %Pointer Inc %p IfInt %p > %Changes %p = 1 SItemGet /s_Schedule %p $a Split $b $c $a "," GetTime !Next $b Split $Next $c $c "," Split $NextFile $c $c "," EndSub Sub ChangeAttributes SListClear /s_Attrib SListLoad /s_Attrib $ThisFile %i Replace /s_Attrib /s_Attrib "{newline}" $CRLF Replace /s_Attrib /s_Attrib "{tab}" $TAB IfInt %i = 0 ChangeAttributes /s_Attrib # Get next Inc %Pointer IfInt %Pointer > %Changes %Pointer = 1 Gosub GetThis Gosub GetNext EndSub |
Two useful links with examples:
Lady NightHawk http://63.249.155.229/Aeon/XelagWorldSched.html
Starheart http://bellsouthpwp.net/d/i/disturber/botscripts/skybox_scripts.htm