Help with timebot and textbot
 

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

Help with timebot and textbot

Started by blackwings, 06 March, 2005, 07:07:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

I have problem with 2 bots.

1st = This text bot doesn't work. the script says it can't find the text file(even if the folder exist in the script folder and the text files is there to) and there is no error messages in ptokax. =
Text bot

2nd = this timebot doesn't work either. I get this error message =
Syntax C:\ptokax1604\scripts\zTimeBotLua5.lua:48: bad argument #1 to `lines' (No such file or directory)
Here is the code for the timebot =
--Timebot for LUA 5
--
-- by blackwings
--Little changed by nErboS
--
-- Converted to LUA 5 by Mutor 2/28/2005
--

bot = "name1"
name2 = "name2"


sec = 60


fMsgAll = "MsgAll.txt"
sMsgAll = ""

fMsgAll2 = "MsgAll2.txt"
sMsgAll2 = ""

tClock = {
	["tMsgAll"] = os.clock() + 1*sec,	-- Time to show in math.minutes
	["tMsgAll2"] = os.clock() + 1*sec,	-- Time to show in math.minutes
}

function Main()
	frmHub:RegBot(bot)
	sMsgAll = Readtext(fMsgAll)
	sMsgAll2 = Readtext(fMsgAll2)
	StartTimer()
end

function OnTimer()
	if (tClock["tMsgAll"] <= os.clock() and sMsgAll~= "") then
		tClock["tMsgAll"] = os.clock() + 150*sec
		SendPmToAll(bot, sMsgAll)
	end
	if (tClock["tMsgAll2"] <= os.clock() and sMsgAll2~= "") then
		tClock["tMsgAll2"] = os.clock() + 220*sec
		SendPmToAll(name2, sMsgAll2)
	end
end

function Readtext(file)
local sTmp="\r\n\r\n"
    for line in io.lines(file) do
        sTmp = sTmp..line.."\r\n"
    end
    return sTmp
end


blackwings

QuoteOriginally posted by Mutor
Do you have MsgAll.txt & MsgAll2.txt in your scripts folder?
lol, I had spelled the filename of one of the files wrong, now it works :D


SMF spam blocked by CleanTalk