Thread: Time Problem
View Single Post
  #4  
Old 10-28-2006, 01:23 AM
Loakey_P2P Loakey_P2P is offline
SL Oldbie
Loakey_P2P's Avatar
Join Date: Apr 2006
Location: U.S.A
Posts: 137
Loakey_P2P is an unknown quantity at this point
Send a message via AIM to Loakey_P2P Send a message via Yahoo to Loakey_P2P
sorry bout that but no it wasnt an error in the script . it was an error on my part in the copy process but here is the code stefan . the time npc we are sure they are working but the flag's are as minute , hour , ect .
PHP Code:
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//Scripter = Loakey_P2P,Loakey Ronso
//information = mostly this will make another variable to the plant growing . which will make the process to grow
//information = stuff vary at times . other stuff will be varying water movement for the raft as well as water baddys
//information = in the end i want this to control rain , snow , ect. as well as string's for thing's mentioned above .
//map info below -
//overworldsize = "54 Levels By 54 Levels"
//corditanitesize = "32400 x 32400"
//x.random(0,32400);
//y.random(0,32400);
//String Info
//rights.time[param]=time between checks
//rights.lastchecked[param]=last time it was checked
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
function onCreated(){                       //sets up basic stuff the script need's to function
  
if(serverr.season == "spring"){         //defines all possable condition's for the seasons
  
this.rights.posconditions "rain,fog,cloudy,clearskies";
  
this.rights.posmoisture "0,100";
  
this.rights.postemperature "+50,+70";
  
this.rights.poswaterlevel "lowtide,naturaltide,hightide";
  
this.rights.poswindconditions "5,30";
  }
  if(
serverr.season == "summer"){
  
this.rights.posconditions "rain,fog,cloudy,clearskies";
  
this.rights.posmoisture "0,100";
  
this.rights.postemperature "+50,100";
  
this.rights.poswaterlevel "lowtide,naturaltide,hightide";
  
this.rights.poswindconditions "10,50";
  }
  if(
serverr.season == "fall"){
  
this.rights.posconditions "rain,fog,cloudy,clearskies";
  
this.rights.posmoisture "0,60";
  
this.rights.postemperature "40,+70";
  
this.rights.poswaterlevel "naturaltide,lowtide";
  
this.rights.poswindconditions "5,30";
  }
  if(
serverr.season == "winter"){
  
this.rights.posconditions "sleet,snow,cloudy,clearskies";
  
this.rights.posmoisture "0,50";
  
this.rights.postemperature "-20,+50";
  
this.rights.poswaterlevel "naturaltide,lowtide";
  
this.rights.poswindconditions "20,50";
  }
  
this.rights.timeconditions "3";
  
this.rights.timemoisture "2";
  
this.rights.timetempature "1";
  
this.rights.timewaterlevel "6";
  
this.rights.timewindconditions "4";
  
this.rights.lastcheckedmoisture "hour";
  
this.rights.lastcheckedtempature "hour";
  
this.rights.lastcheckedconditions "hour";
  
this.rights.lastcheckedwindconditions "hour";
  
this.rights.lastcheckedwaterlevel "hour";
  
TimeCheck();
}

function 
ChangeMoisture(){
  if(
this.rights.weather.conditions == "rain" || "sleet" && this.rights.weather.tempature =< "50"){
  
this.rights.weather.moisture "this.rights.weather.moisture+1";
  }  
//wet and cold adds mositure
  
if(this.rights.weather.conditions == "clearskies" || "cloudy" && this.rights.weather.tempature => "70"){
  
this.rights.weather.moisture "this.rights.weather.moisture-1";
  }  
//dry and warm removes moisture
  
this.rights.lastcheckedmoisture "hour";
}

function 
ChangeTempature(){
  if(
this.rights.weather.conditions == "rain" && this.rights.weather.tempature != "rights.postemperature[1]"){this.rights.weather.tempature "rights.weather.tempature - random(1,5);";}
  if(
this.rights.weather.conditions == "snow"){this.rights.weather.tempature "rights.weather.tempature - random(1,5);";}
  if(
this.rights.weather.conditions == "sleet"){this.rights.weather.tempature "rights.weather.tempature - random(1,5);";}
  if(
this.rights.weather.conditions == "fog"){this.rights.weather.tempature "rights.weather.tempature - 1";}
  if(
this.rights.weather.conditions == "cloudy"){this.rights.weather.tempature "rights.weather.tempature + random(1,5);";}
  if(
this.rights.weather.conditions == "clearskies"){this.rights.weather.tempature "rights.weather.tempature + random(1,5);";}
  
this.rights.lastcheckedtempature "hour";
}

function 
ChangeConditions(){
  
this.newcondition "random(1,4);";
    if(
this.newcondition == "1"){this.rights.weather.conditions "rights.posconditions[0]";}
    if(
this.newcondition == "2"){this.rights.weather.conditions "rights.posconditions[1]";}
    if(
this.newcondition == "3"){this.rights.weather.conditions "rights.posconditions[2]";}
    if(
this.newcondition == "4"){this.rights.weather.conditions "rights.posconditions[3]";}
  unset 
this.newcondition;
  
this.rights.lastcheckedconditions "hour";
}

function 
ChangeWindConditions(){
  
this.rights.windconditions[0] = "random(rights.poswindconditions[0],rights.poswindconditions[1]);"// wind speed
  
this.newdirection "random(0,7)";                                   //wind direction - cords like direction .
    
if(this.newdirection == "0"){this.rights.windconditions[1] = "north";}
    if(
this.newdirection == "1"){this.rights.windconditions[1] = "north-west";}
    if(
this.newdirection == "2"){this.rights.windconditions[1] = "west";}
    if(
this.newdirection == "3"){this.rights.windconditions[1] = "south-west";}
    if(
this.newdirection == "4"){this.rights.windconditions[1] = "south";}
    if(
this.newdirection == "5"){this.rights.windconditions[1] = "south-east";}
    if(
this.newdirection == "6"){this.rights.windconditions[1] = "east";}
    if(
this.newdirection == "7"){this.rights.windconditions[1] = "north-east";}
  unset 
this.newdirection;
  
this.rights.lastcheckedwindconditions "hour";
}

function 
ChangeTide(){
  if(
this.rights.weather.moisture => "50" && this.rights.weather.conditions == "rain" || "sleet"){  // Raise Tide
    
if(this.rights.weather.waterlevel == "lowtide"){
    
this.rights.weather.waterlevel "naturaltide";
    }
    if(
this.rights.weather.waterlevel == "naturaltide"){
    
this.rights.weather.waterlevel "hightide";
    }
    if(
this.rights.weather.waterlevel == "hightide"){
    
this.rights.weather.waterlevel "hightide";
    }
  }
  if(
this.rights.weather.moisture =< "50" && this.rights.weather.conditions == "cloudy" || "clearskies"){  //Lower Tide
    
if(this.rights.weather.waterlevel == "lowtide"){
    
this.rights.weather.waterlevel "lowtide";
    }
    if(
this.rights.weather.waterlevel == "naturaltide"){
    
this.rights.weather.waterlevel "lowtide";
    }
    if(
this.rights.weather.waterlevel == "hightide"){
    
this.rights.weather.waterlevel "naturaltide";
    }
    
this.rights.lastcheckedwaterlevel "hour";
  }
}

function 
TimeCheck(){
  if(
hour == "rights.lastcheckedconditions+rights.timeconditions"){ChangeConditions();}
  if(
hour == "rights.lastcheckedmoisture+rights.timemoisture"){ChangeMoisture();}
  if(
hour == "rights.lastcheckedtempature+rights.timetempature"){ChangeTempature();}
  if(
hour == "rights.lastcheckedwaterlevel+rights.timewaterlevel"){ChangeTide();}
  if(
hour == "rights.lastcheckedwindconditions+rights.timewindconditions"){ChangeWindConditions();}
  if(
this.rights.weather.conditions == "rain" && this.rights.weather.tempature => "70"){
    
this.rights.weather.humidity this.rights.weather.humidity 5;
  } 
  if(
this.rights.weather.conditions == "rain" && this.rights.weather.tempature =< "70"){
    
this.rights.weather.humidity this.rights.weather.humidity 5;
  }
  
sleep("1800");
  
TimeCheck();
}

function 
Acumulation(){

the last function hasnt been made yet . that's one i was putting off to last which will be the actual weather showing part . i dont doubt i made several error's in the process but i was more looking for the difacult problem's . and i cant spell .
__________________
Shaded Legend Playerworld
-Past accounts - LoakeyTheElf - Loakey_P2P
-Past Servers - Rune - Sparitoria - Shaded Legends
-Past Sl Jobs * ET/LAT/NAT/LAT Admin/Developer/Admin/Head Admin/Asst. Manager/Manager
-Current Job - Retired

*Sorry you must have mistaken me for someone that cares .

Last edited by Skyld; 10-28-2006 at 10:58 AM.. Reason: Added PHP tags
Reply With Quote