all righty then, i seem to have it working....and boy was it a simple fix...here is the working code (i even got the times correct)
right now its fully functional but instead of updating a research time available variable it sends that info (debug mode basically)
Code: Select all
if $sizeofarray == 2
$answer = $resarray [ 1 ]
$worked = get index of $answer in array $textarray offset= 0 053 1
$ware = $idarray [ $worked ]
$relval = get relvalue of $ware
$classval = 2500
$class = $ware -> is of class Factory
if $worked >= 1 AND $worked <= 195
$classval = 25000
else
$classval = 2500
end
$base = [THIS] -> call script "divide" : number of fpn array=649239, number of fpn array=10000,
$base = [THIS] -> call script "prod" : number 1=$base, number 2=$relval,
$scraptime = [THIS] -> call script "prod" : number 1=$base, number 2=60,
$scraptime = [THIS] -> call script "divide" : number of fpn array=$scraptime, number of fpn array=$classval,
$scraptime = [THIS] -> call script "divide" : number of fpn array=$scraptime, number of fpn array=2,
$scraptime = [THIS] -> call script "float2int" : fpn array (s,m,e)=$scraptime,
if $scraptime < 15
$scraptime = 15
end
$starttime = $restime [ 1 ]
$currtime = playing time
if not $starttime == -1
$time = $currtime - $starttime
$x = $scraptime - $time
$hours = $x / 3600
$temp = $x - $hours * 3600
$hours = $hours + 100
$hours = sprintf: fmt= "%s" , $hours , null , null , null , null
$hours = get substring of $hours offset= 1 length= 2
$mins = $temp / 60
$temp = $temp - $mins * 60
$mins = $mins + 100
$mins = sprintf: fmt= "%s" , $mins , null , null , null , null
$mins = get substring of $mins offset= 1 length= 2
$temp = $temp + 100
$temp = sprintf: fmt= "%s" , $temp , null , null , null , null
$temp = get substring of $temp offset= 1 length= 2
$timeleft = sprintf: fmt= "%s:%s:%s" , $hours , $mins , $temp , null , null
$Title = "BP Manager Message"
$Messagebody = "Research time remaining: " + $timeleft
$Message = sprintf: pageid= 8117 textid= 400 , $Author , $Title , $Messagebody , null , null
$Hardreturn = sprintf: pageid= 8117 textid= 203 , $Author , $Title , $Messagebody , null , null
$menu = $Message + $Hardreturn
$test = [THIS] -> call script "lib.st.md.message.ask" : pageid OR message string=$menu, textid OR null=null, arg1 OR null=null, arg2 OR null=null, arg3 OR null=null, arg4 OR null=null, arg5 OR null=null,
if $time >= $scraptime
$restime [ 1 ] = -1
append $answer to array $installedfactories
remove element from array $resarray at index 1
set global variable: name= $researchtime value= $restime
set global variable: name= $localinstalledfactories value= $installedfactories
set global variable: name= $researcharray value= $resarray
$Hardreturn = sprintf: pageid= 8117 textid= 203 , $Author , $Title , $Messagebody , null , null
$Author = "IFTSOS Management"
$Title = "BP Manager Message"
$Messagebody = "Installed"
$Message = sprintf: pageid= 8117 textid= 400 , $Author , $Title , $Messagebody , null , null
$menu = $Message
$test = [THIS] -> call script "lib.st.md.message.ask" : pageid OR message string=$menu, textid OR null=null, arg1 OR null=null, arg2 OR null=null, arg3 OR null=null, arg4 OR null=null, arg5 OR null=null,
end
else
$restime [ 1 ] = $currtime
set global variable: name= $researchtime value= $restime
end
end
note: i had to divide scraptime by 2 to get the same time that the pHQ gets....trying to figure out why
edit: the reason its >= 1 and <= 195 is because the 0 id is "blank entry" and the first 195 entries in both the textarray and idarray are factories - i can use this for all but the ships....the ships ill just have to sort in the array before it will work with them, which is no problem being as it doesn't matter if this array is sorted, so long as the text and id are in the same positions (and now so long as they are all in the correct blocks)
question: how many BPs should a player be able to research at the same time?
...current catagories are ships weapons upgrades and factories or should i limit it to one....for production ive decided on 2 ship or factories (or 1 of each) 5 weapons and 10 upgrades