change over to lua5
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

change over to lua5

Started by night_hawk, 18 April, 2005, 05:20:43

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

night_hawk

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

Madman

#1
--//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
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

night_hawk

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

SMF spam blocked by CleanTalk