Script error (trying to convert it)
 

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

Script error (trying to convert it)

Started by Markitos, 19 October, 2005, 16:12:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Markitos

I get this [16:11] Syntax ...ts\Downloads\Programs\Ptokax\scripts\!requesitos.LUA:20: attempt to call global `ReadJokes' (a nil value)

---/-- File reader
---/-- Feito por?
---/-- Brevemente sera convertido em lua 5
---/-- Cmd !ler


Bot = "nomedobot" 
filename = "ala.txt" --O ficheiro tem de estar criado na pasta script  


function Main() 
   frmHub:RegBot(Bot) 
end 

function ChatArrival(user, data) 
   if (string.sub(data,1,1)=="<") or (string.sub(data,1,5+string.len(Bot))=="$To: "..Bot) then 
   data=string.sub(data,1,string.len(data)-1) 
   s,e,cmd = string.find(data,"%b<>%s+(%S+)") 
      if (cmd=="!ler") then 
      ReadJokes(user, data) 
        return 1 
      end 
   end 
end 

function ReadFromFile(filename)

	local file = io.open(filename, "r") -- "r" read

	for line in file:lines() do

	user:SendPM(Bot, tmp) 

	end

	file:close()

end

Please help me...trying to convert it to lua 5

TTB

I made thisone a little while ago:

-- Simple TXT / file viewer by TTB
-- Requested by Pingelmonster
-- Made: 06-05-05
----------------------------------

-- ## Settings ## --

bot = "[BOT]TXT-assistent"	-- botname
path = "extratxt"		-- path for your txt file(s)

File1= "hublists.txt"		-- filename
cmd1 = "#hublists"		-- command

regbot = "0" 			-- Reg your bot?
PM = "1"			-- Send your message by PM or in MAIN chat? 1 = PM, 0 = Main Chat.

-- NOTE: If you choose to send by PM, your bot will be REGGED anyway (can't send PM without sender).

-- ## Don't change below! ## --

function Main()
	if regbot == "1" or PM == "1" then
		frmHub:RegBot(bot)
	end
end

function ChatArrival(curUser,data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
	if cmd and cmd == cmd1 then
		local sdata = LoadFile(File1)
		if PM == "1" then
			curUser:SendPM(bot,"\r\n"..sdata)
		else
			curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")
		end
		return 1
	end
end

function LoadFile(file)
	local handle = io.open(path.."/"..file,"r")
	if handle then
		local sdata = ""
		local line = ""
		for line in handle:lines() do
			sdata = sdata..line.."\r\n"
		end
		return sdata
	else
		sdata = "File / command not available!"
		return sdata
	end
	handle:close()
end
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Markitos


SMF spam blocked by CleanTalk