hi i need help changing this user to lua.5
--//A Simple Request Board For The Hub
--//(Mr420)
--//Thanks To aMutex for the Guestbook, and all others who script for thier advice and help
--//Thanks To Xander for help testing
--//Version 3.0
botname = "?RequestBoard?"
bot_email = "Hawks-Friends-Family.no-ip.com:555"
bot_speed = "Cable"
bot_descr = "Type !help In PM To Me."
bot_share_size = 000.0 * 0 *0
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..strchar( 1 ).."$"..bot_email
TimeSpanInMinutes = 60 --//You May Change This
function Main()
frmHub:RegBot(botname)
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..strchar( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end
function NewUserConnected(curUser)
curUser:SendData( my_info_string )
end
function OpConnected(curUser)
curUser:SendData( my_info_string )
end
function OnTimer()
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HI THERE!!!!, I'm The Nights Request Board.")
SendToAll(" Do You Need A Specific File, Or Want To Tell The Hub Something???")
SendToAll(" POST IT!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" To Post, Simply Send !help As A Private Message,")
SendToAll(" To Nights Request Board. Please Be As Specific As You Can.")
SendToAll(" Check Back To See If Someone Has Obtained Your File Or Responded To Your Post.")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end
function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function DataArrival(user, data)
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="!help") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," This is Nights Request Board!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Type !help To View This Help Menu.")
user:SendPM(botname," Type !post To Post In The Bulletin.")
user:SendPM(botname," Type !view To View The Posted Requests/Posts.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Please Be As Specific As You Can.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
if (cmd=="!post") then
SendToAll("***New Post Added In Nights Request Board!***")
arg= GetArgs(data)
local handle=openfile("post.dat","a")
write(handle,"("..user.sName..") posted :"..arg.."?")
user:SendPM(botname,"Post entry saved ....")
closefile(handle)
end
if (cmd=="!view") then
handle2=openfile("post.dat","r")
if (handle2==nil) then
else
line = read(handle2,"*a")
line=strsub(line,1,strlen(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray)
end
closefile(handle2)
end
end
end
end
end
--//A Simple Request Board For The Hub
--//(Mr420)
--//Thanks To aMutex for the Guestbook, and all others who script for thier advice and help
--//Thanks To Xander for help testing
--//Version 3.0
---- Modded by Madman
-- Converted to lua5
-- Added: An option to rename the file
-- Removed: The tokenize function, cant see why we need it..
-- Changed: Some curUser to user, dont like diffrent User in same script
-- Fixed: Bot not showing, info string
botname = "RequestBoard"
bot_email = "Hawks-Friends-Family.no-ip.com:555"
bot_speed = "Cable"
bot_descr = "Type !help in PM to me."
bot_share_size = 000.0 * 0 *0
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email.."$"..bot_share_size.."$"
TimeSpanInMinutes = 60 --//You May Change This
filename = "post.dat"
function Main()
frmHub:RegBot(botname)
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email.."$"..bot_share_size.."$"
SendToAll(my_info_string)
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end
function NewUserConnected(user)
user:SendData( my_info_string )
end
function OpConnected(user)
user:SendData( my_info_string )
end
function OnTimer()
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HI THERE!!!!, I'm The Nights Request Board.")
SendToAll(" Do You Need A Specific File, Or Want To Tell The Hub Something???")
SendToAll(" POST IT!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" To Post, Simply Send !help As A Private Message,")
SendToAll(" To Nights Request Board. Please Be As Specific As You Can.")
SendToAll(" Check Back To See If Someone Has Obtained Your File Or Responded To Your Post.")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function ToArrival(user, data)
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="!help") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," This is Nights Request Board!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Type !help To View This Help Menu.")
user:SendPM(botname," Type !post To Post In The Bulletin.")
user:SendPM(botname," Type !view To View The Posted Requests/Posts.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Please Be As Specific As You Can.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
if (cmd=="!post") then
arg= GetArgs(data)
local file = io.open(filename, "a+") -- "a+"
file:write("\r\n(" ..user.sName..") posted : " ..arg)
user:SendPM(botname,"Post entry saved ....")
SendToAll("***New Post Added In Nights Request Board!***")
file:close()
end
if (cmd=="!view") then
local file = io.open(filename, "r")
if file then
file:close()
local file = io.input(filename)
local line = io.read("*a")
line = string.gsub(line, "\n", "\r\n")
user:SendPM(botname, line)
file:read()
file:close()
else
user:SendPM(botname, "No request has been made")
end
end
end
end
done...
and plese next time post the code with
[code*]
-- your code here
[/code*]
without the *ofcourse
thank you
and i am sorry did not now what you mean about code...
i am sorry and it works fine now
do you know how to cunvert or scripts..
as i know nothing about scripting