PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: [NL]trucker on 10 November, 2003, 13:33:17

Title: can someone help?????
Post by: [NL]trucker on 10 November, 2003, 13:33:17
i have a script i cant get to work
all the time i get this error:

Syntax Error: expected;
  last token read: `,' at line 44 in file `E:\pkotac build 15.11\scripts\info.lua'
Syntax Error: attempt to concat global `BotName' (a nil value)

and next question can you also make it so that the hubuptime is also shown automaticly whitout the need of sending a command?

here is the script:
--------------------------------------------------------------------------------

-- Uptime by extracted from retrobot By Skrollster
-- Retrobot is made by Tezlo
-- Hiding of command from MainChat is added by JenZen?


BotName = "hubinfo"

sek = 1000
min = sek*60
hour = min*60
days = hour*24

time = 1*hour

function Main()
SetTimer(time)
StartTimer()
end


function DataArrival(user, data)
-- remove end pipe
data=strsub(data,1,strlen(data)-1)
--extract command
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hours "..min.."

minutes and "..sec.." seconds")
return 1;
end
end


function OnTimer()
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
SendToAll(BotName),

"?=============="..frmHub:GetHubName().."=================| ?|"
::HubOwner:[NL]trucker-TeQuilla-hollandse.ko
::Hub-eMail:pfokkink@hotmail.com
::Hub Address: funnyhub.no-ip.info
::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !! Dutch  

Located :) Dus NLers Welkom !! =
::Uptime = "..days.." days, "..hrs.." hours "..min.." minutes and

"..sec.." seconds = ?")
SendToAll(BotName, "?============="..frmHub:GetUsersCount().." of

"..frmHub:GetMaxUsers().." Users Connected==================")
end
end

----------------------------------------------------------------------------------

so if someone could fix this i would very much appriciate it .
Title:
Post by: pHaTTy on 10 November, 2003, 13:46:06
here you go m8


-- Uptime by extracted from retrobot By Skrollster
-- Retrobot is made by Tezlo
-- Hiding of command from MainChat is added by JenZen?
-- fixed by phatty


BotName = "hubinfo"

sek = 1000
min = sek*60
hour = min*60
days = hour*24

time = 1*hour

function Main()
SetTimer(time)
StartTimer()
end


function DataArrival(user, data)
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hours "..min.." minutes and "..sec.." seconds")
return 1
end
end


function OnTimer()
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
SendToAll(BotName,"?=============="..frmHub:GetHubName().."=================| ?|")
SendToAll(BotName,"::HubOwner:[NL]trucker-TeQuilla-hollandse.ko")
SendToAll(BotName,"::Hub-eMail:pfokkink@hotmail.com")
SendToAll(BotName,"::Hub Address: funnyhub.no-ip.info")
SendToAll(BotName,"::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !! Dutch")
SendToAll(BotName,"Located :) Dus NLers Welkom !! = ::Uptime = "..days.." days, "..hrs.." hours "..min.." minutes and "..sec.." seconds = ?")
SendToAll(BotName,"?============="..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected==================")
end




l8rr,, enjoy ;)
-phatz
Title:
Post by: [NL]trucker on 10 November, 2003, 20:34:15
Phatty thnx m8

i have installed the bot and sofar no errors.

my thanx are endless :-)))
Title:
Post by: pHaTTy on 10 November, 2003, 20:47:59
np at all m8 glad i cud help :o)