[Head] Type=Script Version=2.0 [Settings] Origin=0.000n 0.000w 0.00a 0.0° run [Script] killsay var $wdurl, $stationlocation, $datetime, $wind, $vis, $skycond, $temp, $windchill, $dewpoint, $humidity, $pressure, $wforcasturl, $nowcasturl var %dresult, %listloadresult, %intvis, %winddir, %windspeed, %inttemp, %windx, %windz, %winddirsin, %winddircos, %listcount var /s_weatherdata, /s_weatherforcast, /s_weathernowcast, /s_lightdata var $adjtemp, $adjtemp1, $adj, $adj1, $adj2, $winddir, $windspeed, $adjvis, $adjvis1, $chat, var $world, $fogmin, $fogmax, var $watertex, %waterop, %wcred, %wcgreen, %wcblue, %wlevel, %wwavemove, %wsurfacemove, %wspeed var $c1tex, %c1op, $C2tex, %c2op, $c3tex, %c3op, %c1speedx, %c1speedz, %c2speedx, %c2speedz, %c3speedx, %c3speedz, $c1mask, $c2mask, $c3mask, Var %localhour, %localminute, $localhour var %ambientr, %ambientb, %ambientg, %sun, %sunsize, %sky, %dred, %dgreen, %dblue, %azi, %alti, var %snred, %sngreen, %snblue, %ssred, %ssgreen, %ssblue, %sered, %segreen, %seblue, %swred, %swgreen, %swblue, %stred, %stgreen, %stblue, %sbred, %sbgreen, %sbblue var $skyboxmorning, $skyboxnoon, $skyboxsunset, $skyboxnight, $cloud1texture, $cloud1mask, $cloud2texture, $cloud2mask, $cloud3texture, $cloud3mask var $suntexture, $moontexture, $sunmask, $moonmask, $waterbottomtexture, $watertoptexture, $watericetexture slistclear /s_weatherdata slistclear /s_weatherforcast slistclear /s_weathernowcast OnDownloadCompleteEvent Ddone onchatevent chat ###to set it up for the weather in your area goto http://weather.noaa.gov/pub/data/observations/metar/decoded/ ###and find the weather station near you. this is just a directory listing that lists all of the NWS weatherstations ###it will take a long time to load. you may think your browser has stalled but it hasnt. If you do not know the ###name of your local weather station (its like a tv or radio callsign. it is not a tv channel. well thats not entirely true, it may be.) ###if you dont know the name of your local weather station look for the call letters of your local airport. for example Sea/Tac airport in seattle is KSEA. Boise is KBOI $wdurl = http://weather.noaa.gov/pub/data/observations/metar/decoded/KBOI.TXT $wforcasturl = http://weather.noaa.gov/pub/data/forecasts/city/id/boise.txt $nowcasturl = http://weather.noaa.gov/pub/data/forecasts/nowcast/id/idz012.txt getworld $world ##Below are the values the bot uses for textures and other world specific data.## ##This is where you can enter the names of the skyboxes you want to use and the cloud textures## #if you would like to use the skycolors instead of skyboxes you can set the skybox textures to " " ## $skyboxmorning = "sky_morning" $skyboxnoon = "sky_noon" $skyboxsunset = "sky_sunset" $skyboxnight = "sky_midnight" $cloud1texture = "Clouds1 $cloud1mask = "clouds1" $cloud2texture = "Clouds1" $cloud2mask = "clouds1" $cloud3texture = "Clouds1" $cloud3mask = "clouds1" $suntexture = "c_sun" $sunmask = "c_sun" $moontexture = "moon-big" $moonmask = "moon-big" $watertoptexture = "water1_top" $waterbottomtexture = "water1_top" $watericetexture = "ice1" #the ice texture is used when the temp falls below 32f.## ##Default speed values for cloud levels 2 and 3 ##Speed values for cloud level 1 are set by the weather data %c2speedx = -0.61604 %c2speedz = -0.78771 %c3speedx = 0.1 %c3speedz = -0.1 getlocalhour %localhour $localhour = %localhour #$localminute = 30 gosub lightupdate gosub wupdate label start OnDownloadCompleteEvent Ddone getlocalhour %localhour getlocalminute %localminute ifint %localminute = 30 gosub lightupdate wait 60 ifint %localminute = 0 goto hour goto start label hour say Updating Weather. gosub lightupdate gosub wupdate goto start label end End sub lightupdate concat $localhour %localhour #58 %localminute ##secret $localhour slistload /s_lightdata "lightdata.txt" slistgetfields /s_lightdata $localhour 30 %ambientr %ambientg %ambientb %sun %sunsize %sky %dred %dgreen %dblue %alti %azi %snred %sngreen %snblue %ssred %ssgreen %ssblue %sered %segreen %seblue %swred %swgreen %swblue %stred %stgreen %stblue %sbred %sbgreen %sbblue ##secretconcat %ambientr #10 %ambientg #10 %ambientb #10 $sun #10 %sunsize #10 $sky #10 %dred #10 %dgreen #10 %dblue #10 %alti #10 %azi gosub changeattributes return sub wupdate #secret Downloading current weather data. Download $wdurl return event Ddone geteventresult %dresult #secretconcat %dresult ifint %dresult = 0 gosub success else gosub fail gosub usedata endevent sub success #secret Weather data successfuly downloaded. Loading data. slistload /s_weatherdata "../downloads/kboi.txt" %listloadresult ifint %listloadresult = 0 gosub listloadsuccess else gosub listloadfail return sub fail #secret Download of current weather data failed. #secret Current weather settings for the world will remain unchanged. #secret Next update in one hour. resetto start return sub listloadsuccess #secret Weather data successfuly loaded into the bot. #secret Interpreting data and setting world weather attributes. return sub listloadfail #secret Weather data load failed. #secret Check script settings and paths then reload the script and try agian. #secret Ending script. resetto end return sub usedata #slistget /s_weatherdata 1 $stationlocation #slistget /s_weatherdata 2 $datetime #slistnoblanks /s_weatherdata slistcount /s_weatherdata %listcount %i = 1 #secretconcat %i #32 %listcount label weatherin ifint %i > %listcount goto weatherout slistget /s_weatherdata %i $f #secret $f ifstring "Wind:" isin $f gosub parsewind ifstring "Visibility:" isin $f gosub parsevis ifstring "Sky conditions:" isin $f gosub parseclouds ifstring "Temperature:" isin $f gosub parsetemp else goto weathercontinue label weathercontinue inc %i goto weatherin label weatherout gosub changeattributes return sub parsevis $vis = $f secretconcat "vis: " $vis split $adjvis $adjvis1 $vis : $a = #32 splitfromend $adjvis $adjvis1 $adjvis1 $a trim $adjvis1 $adjvis %intvis = $adjvis1 #secretconcat %intvis intmul %intvis %intvis 100 ifstring "1/2" isin $adjvis1 %intvis = 50 ifstring "1 1/2" isin $adjvis1 %intvis = 150 ifstring "3/4" isin $adjvis1 %intvis = 75 ifstring "1/4" isin $adjvis1 %intvis = 25 ifstring "2 1/2" isin $adjvis1 %intvis = 250 secretconcat "visiblity " %intvis return sub parsewind $wind = $f #secretconcat "wind: " $wind split $adj $adj1 $wind ( split $winddir $adj2 $adj1 degrees #secret $winddir split $adj $adj1 $adj2 at split $windspeed $adj $adj1 mph #secretconcat "wind$ " $windspeed trim $winddir $winddir trim $windspeed $windspeed %winddir = $winddir %windspeed = $windspeed #secretconcat "dir " %winddir #secretconcat "speed " %windspeed sin %winddirsin %winddir cos %winddircos %winddir mul %c1speedx %winddirsin %windspeed mul %c1speedz %winddircos %windspeed return sub parseclouds $skycond = $f secretconcat "sky: " $skycond split $adj $skycond $skycond : trim $skycond $skycond #secret $skycond ifstring "clear" isin $skycond gosub clearsky ifstring "fair" isin $skycond gosub fairsky ifstring "mostly clear" isin $skycond gosub mostsun ifstring "partly cloudy" iswordin $skycond gosub partcloud ifstring "mostly cloudy" iswordin $skycond gosub mostcloud ifstring "overcast" isin $skycond gosub overcast return sub clearsky $c1tex = " " $c1mask = " " %c1op = 0 $c2tex = " " $c2mask = " " %c2op = 0 $c3tex = " " $c3mask = " " %c3op = 0 return sub fairsky $c1tex = " " $c1mask = " " %c1op = 0 $c2tex = " " $c2mask = " " %c2op = 0 $c3tex = " " $c3mask = " " %c3op = 0 return sub mostsun $c1tex = $cloud1texture $c1mask = $cloud1mask %c1op = 75 $c2tex = " " $c2mask = " " %c2op = 0 $c3tex = " " $c3mask = " " %c3op = 0 return sub partcloud $c1tex = $cloud1texture $c1mask = $cloud1mask %c1op = 125 $c2tex = $cloud2texture $c2mask = $cloud2mask %c2op = 125 $c3tex = $cloud3texture $c3mask = $cloud3mask %c3op = 125 return sub mostcloud $c1tex = $cloud1texture $c1mask = $cloud1mask %c1op = 175 $c2tex = $cloud2texture $c2mask = $cloud2mask %c2op = 175 $c3tex = $cloud3texture $c3mask = $cloud3mask %c3op = 175 return sub overcast $c1tex = $cloud1texture $c1mask = $cloud1mask %c1op = 255 $c2tex = $cloud2texture $c2mask = $cloud2mask %c2op = 255 $c3tex = $cloud3texture $c3mask = $cloud3mask %c3op = 255 return sub parsetemp $temp = $f #secretconcat "temp: " $temp split $adj $adj1 $temp : $a = #32 splitfromend $adj $adj1 $adj1 $a trim $adj1 $adj %inttemp = $adj1 #intmul %inttemp %inttemp 1609 #secretconcat %inttemp ifint %inttemp <= 32 gosub belowfreezing ifint %inttemp > 32 gosub abovefreezing return sub belowfreezing $watertex = $watericetexture %waterop = 255 %wcred = 0 %wcgreen = 128 %wcblue = 255 %wlevel = -0.3 %wwavemove = 0 %wsurfacemove = 0 %wspeed = 0 return sub abovefreezing $watertex = $watertoptexture %waterop = 175 %wcred = 0 %wcgreen = 128 %wcblue = 255 %wlevel = -0.9 %wwavemove = -0.5 %wsurfacemove = 0.3 %wspeed = 1.5 return sub changeattributes setworld $world fogenable on fogmaximum %intvis #secretconcat "fogmax " %intvis watertoptexture $watertex waterbottomtexture $waterbottomtexture wateropacity %waterop watercolor %wcred %wcgreen %wcblue waterlevel %wlevel waterwavemove %wwavemove watersurfacemove %wsurfacemove waterspeed %wspeed clouds1texture $c1tex clouds1mask $c1mask clouds1opacity %c1op clouds1speedx %c1speedx clouds1speedz %c1speedz clouds2texture $c2tex clouds2mask $c2mask clouds2opacity %c2op clouds2speedx %c2speedx clouds2speedz %c2speedz clouds3texture $c3tex clouds3mask $c3mask clouds3opacity %c3op clouds3speedx %c3speedx clouds3speedz %c3speedz ambientcolor %ambientr %ambientg %ambientb ifint %sun = 0 worldlighttexture $moontexture ifint %sun = 1 worldlighttexture $suntexture ifint %sun = 0 worldlightmask $moonmask ifint %sun = 1 worldlightmask $sunmask #worldlighttexture $sun #worldlightmask $sun worldlightdrawsize %sunsize ifint %sky = 0 skybox $skyboxmorning ifint %sky = 1 skybox $skyboxnoon ifint %sky = 2 skybox $skyboxsunset ifint %sky = 3 skybox $skyboxnight #skybox $sky directcolor %dred %dgreen %dblue directpolarh %azi %alti enablewater on skyncolor %snred %sngreen %snblue skyscolor %ssred %ssgreen %ssblue skyecolor %sered %segreen %seblue skywcolor %swred %swgreen %swblue skytcolor %stred %stgreen %stblue skybcolor %sbred %sbgreen %sbblue changeattributes return event chat getchatperson &p getchatline $chat #ifstring "whats the weather like" isin $chat gosub weatherreport ifstring "/weatherreport" iswordin $chat gosub weatherreport ifstring "/weatherforcast" iswordin $chat gosub weatherforcast ifstring "/nowcast" iswordin $chat gosub nowcast ifstring "/av" isin $chat gosub avchange else endevent endevent sub avchange $d = #32 split $b $c $chat /av trim $e $c %f = $e avset &p %f return sub weatherreport conmsgcolor 0 0 255 conmsgstyle 1 0 conmsg &p Current Weather report from The National Weather Service on which world weather settings are based. unformatted conmsgtext 0.00001 &p /s_weatherdata conmsgconcat &p #0 "The weather data is updated about every hour." return sub weatherforcast conmsgcolor 0 0 255 conmsgstyle 1 0 conmsg &p Downloading current weather forcast. ondownloadcompleteevent fordown download $wforcasturl return event fordown geteventresult %dresult ifint %dresult = 0 gosub forsuccess endevent sub forsuccess conmsgcolor 0 0 255 conmsgstyle 1 0 #secret forcast downloaded conmsg &p Current weather forcast from the National Weather Service. unformatted slistload /s_weatherforcast "../downloads/boise.txt" conmsgtext 0.00001 &p /s_weatherforcast conmsg &p Forcast complete. return sub nowcast conmsgcolor 0 0 255 conmsgstyle 1 0 conmsg &p Downloading short term forcast. ondownloadcompleteevent nowdown download $nowcasturl return event nowdown geteventresult %dresult ifint %dresult = 0 gosub nowsuccess endevent sub nowsuccess conmsgcolor 0 0 255 conmsgstyle 1 0 #secret forcast downloaded conmsg &p Current short term weather forcast from the National Weather Service. unformatted slistload /s_weathernowcast "../downloads/idz012.txt" conmsgtext 0.00001 &p /s_weathernowcast conmsg &p Short term forcast complete. return