request: Random quote
 

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

request: Random quote

Started by Cosmos, 04 June, 2005, 22:58:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cosmos

Simply a data file... 1 quote per line

and then any user can type !getquote or something and it will say 1 of the quotes in the main chat for everyone to see.

I did this in IRC and it was a big hit..  but basically whenever the chat is slow people type !getquote  and itll display one of the funny quotes.. in my case i want to use a list of funny things people have said in the hub..

jiten

Found this one in my scripts folder:
------------------------------------------------------------------------
------
--// Send Random Text Line every x minute // By NightLitch
-- little mod by Dessamator, added memlines and memory
------------------------------------------------------------------------------
cBotName = "botnamehere" -- enter botname
cFilename = "memories.txt" -- enter filename
cTime = 10 -- enter time in minutes
------------------------------------------------------------------------------
lineTable = {n=0}

function Main()
frmHub:RegBot(cBotName)
GetLines(cFilename)
SetTimer(cTime*60000)
StartTimer()
end


function OnTimer()
	SendStuff()
end

function GetLines(filename)
local file = io.open(filename, "r")
		for line in file:lines() do
			table.insert(lineTable, line)
		end
file:close()
end

function ChatArrival(curUser, sdata)

	local s, e, cmd, args = string.find(sdata, "^%b<> %!(%a+)%s*(.*)|$")
	if curUser.bOperator then
		if cmd == "memories" then
			SendStuff()
			return 1
		elseif cmd == "memaddline"  then
			addline("memories.txt", args)
			curUser:SendData(cBotName,"Done ,memory added")
			return 1
		end
	end
end 

function SendStuff()
	GetLines(cFilename)
	local message = lineTable[math.random(1,table.getn(lineTable))]
	SendToAll(cBotName, message)
         return message
end

function addline(filename,msg)
local file = io.open(filename, "a+")
file:write("\n"..msg)
file:close()
end

Meka][Meka

i've wrote an external version about 3 month ago in c#, i'm gonna rewrite in either delphi or c++, once i do i'll release it here also
Do you know what \'nemesis\' means? A righteous infliction of retribution manifested by an appropriate agent. Personified in this case by an \'orrible cunt... me.



SMF spam blocked by CleanTalk