PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: Northwind on 17 September, 2005, 16:58:14

Title: Day, time and quote
Post by: Northwind on 17 September, 2005, 16:58:14
hi again :)

Can somebody make this, it shouild be before MOTD

=================================
Today is #date and hub's current time is #time

Quote of day #quote
=================================

#quote1 "T?m? p?iv? on huomisen eilinen."
#quote2 "I?ll? ei ole merkityst? ellei satu olemaan juusto."
#quote3 "Mik? pahan tappaisi"
#quote4 "Kaikkihan me kuljemme loassa, toiset vain katsovat t?htiin."

i have more quotes but those are examples...

Title: Somebody can...
Post by: Dessamator on 17 September, 2005, 17:05:59
But, im quite sure a similar script already exists somewhere in this forum.
Title:
Post by: Northwind on 17 September, 2005, 19:26:01
I tried to search, ... but nothing fit the purpose... or maybe i use wrong search words. Dunno... If somebody was lucky and find the script what fit the purpose please post it...

Have to try couple more times  :D  :D
Title:
Post by: bastya_elvtars on 17 September, 2005, 19:52:16
What about having a quote list in a file?
Title:
Post by: Northwind on 17 September, 2005, 23:18:57
yeah that would be good idea :) but first i need a script what shows those things
Title:
Post by: bastya_elvtars on 17 September, 2005, 23:52:36
When should the quote with time show? On connect/specified intervals/what?
Title:
Post by: Northwind on 18 September, 2005, 00:16:13
Everytime when a user enter the hub on the same day he sees same quote. Only time changes.

Sorry iam little ill so my brains dont work right... tried my best to say what i need....
Title:
Post by: bastya_elvtars on 18 September, 2005, 00:48:13
QuoteOriginally posted by Northwind
Everytime when a user enter the hub on the same day he sees same quote. Only time changes.

Sorry iam little ill so my brains dont work right... tried my best to say what i need....

So there is the quote of the day and a random quote can be shown at any time by a command?
Title:
Post by: Northwind on 18 September, 2005, 10:12:59
no random only that quote what is before motd... and when somebody type !quote it show this days quote... so i only need 365 quotes for a year...
Title:
Post by: bastya_elvtars on 18 September, 2005, 13:15:04
QuoteOriginally posted by Northwind
no random only that quote what is before motd... and when somebody type !quote it show this days quote... so i only need 365 quotes for a year...

So basically it just chooses a quote every day? :-)
Title:
Post by: Northwind on 18 September, 2005, 14:44:49
yeah :)

can u make the script
Title:
Post by: Northwind on 18 September, 2005, 16:28:32
thanks, i am  going to test it tonight...
Title:
Post by: kunal on 19 September, 2005, 15:49:53
nothing is being shown below the motd also when i use the cmd +qod nothing appears.
Title:
Post by: Northwind on 20 September, 2005, 10:26:16
[11:42] Syntax D:\moon_3\scripts\qot.lua:139: attempt to index global `QOD' (a nil value)
Title:
Post by: Psycho_Chihuahua on 20 September, 2005, 23:19:48
Well i put a copy in the Scriptdb including the quote file

you can find it here --> QOD.rar (http://ptxscriptdb.psycho-chihuahua.net/download.php?view.95)

@Mutor: Hope you dont mind  :D
Title:
Post by: Psycho_Chihuahua on 21 September, 2005, 00:26:17
Sure no problem, i thought they could add the quotes themselfs  :D

Here ya go --> Link to v1.0b Script and full Quote file from Scriptdb (http://ptxscriptdb.psycho-chihuahua.net/download.php?view.96)
Title:
Post by: kash? on 19 November, 2005, 21:12:23
I wanted a option whether to show qoute in main
or PM or not to show at all either in main or PM
but right click commands should work in all 3 options

Waiting Reply,
Title:
Post by: kash? on 20 November, 2005, 10:18:39
Nice1

but can u plz make that right click option
for toggle quotes on/off and toggle pms on/off and
list all QOD's only for ops so that ops will get all four options in right click but others will get only ONE
option of show Quote of the day

Regards
Title:
Post by: 6Marilyn6Manson6 on 20 November, 2005, 12:30:54
This for example:


--
--QOD 1.0c LUA 5
--
--by Mutor The Ugly 9/18/05
--
--Requested by Northwind
--
-- Sends a 'Quote Of The Day' to new logins
-- Option to list all quotes in PM
-- Checks for existance of quote file alerts OpChat if OpChat enabled, all users if not.
-- Provides context menu.
--
-- +Changes from v1.0  9/18/05
-- +Changed display format of quote to that of request
--
-- +Changes from v1.0b  11/19/05 Requests by kash?
-- +Added option to toggle script on/off
-- +Added option to toggle PM's on/off
-- +Added new commands to context menu (right click)
--

--User Settings------------------------------------------------
QODFile = "QOD.dat"             --QOD file
QODList = "+listqod"            --List all QOD's in PM
QODCmd = "+qod"                 --Get Todays quote
QODEnable = "+qon"              --Toggle quotes on/off
QODOn = "on" --Quotes on at script start? "on"/"off"
QODPmOn = "+qpm" --Toggle display of quotes in pm on/off
QODPm = "off" --Should send in pm at script start? "on"/"off"
QODBot = frmHub:GetHubBotName() --QODBot name pulled from hub or use "custom name"
QodMenu = frmHub:GetHubName() --Menu name pulled from hub, uses hub name for menu
QodSubMenu ="Quote Of The Day" --Custom submenu
[COLOR=red]QodUserCommands = 1 -- Send usercommands on connect 1=on/0=off[/COLOR]
--End User Settings--------------------------------------------

local timein=os.date("%B %d %Y")

function Main()
local f,e = io.open( QODFile, "r" )
if f then
        dofile(QODFile)
else
local QodFileErrMsg="\r\n\r\n\tFile Error: "..QODFile.." does not exist.\r\n"
if not (frmHub:GetOpChatName()) then
SendToOps(QODBot,QodFileErrMsg)
else
SendPmToOps(frmHub:GetOpChatName(),QODBot..QodFileErrMsg)
end
end
if QODBot ~= frmHub:GetHubBotName() then
frmHub:RegBot(QODBot, 1, "Quote Of The Day", "")
end
end

function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
local s,e,cmd = string.find(data, "^%b<>%s+(%p%w+)")
if cmd then
if cmd == QODCmd and QODOn == "on" then
local day = tonumber(os.date("%j"))
if QOD[day] then
local Quote = "\r\n\r\n\t"..string.rep("=",100).."\r\n\tToday "..
"is "..os.date("%B %d %Y").." and "..frmHub:GetHubName().."'s current "..
"time is "..os.date("%I:%M %p").."\r\n\t[ Quote Of The Day: ]\r\n\t\" "..QOD[day]..
"\r\n\t"..string.rep("=",100).."\r\n\r\n"
if QODPm == "on" then
user:SendPM(QODBot,Quote)
return 1
else
user:SendData(QODBot,Quote)
return 1
end
end
elseif cmd == QODList then
local Quote = "\r\n\r\n"
for i,v in QOD do
Quote = Quote.."[Day #"..i.."] : "..v.."\r\n\r\n"
end
user:SendPM(QODBot,"\r\n\r\n"..string.rep("=",75).."[ Quotes Of The Day ]"..
string.rep("=",25)..Quote.."\r\n"..string.rep("=",75).."[ End Quote Listing ]"..string.rep("=",25).."\r\n")
return 1
elseif cmd == QODEnable then
if QODOn == "on" then
QODOn = "off"
elseif QODOn == "off" then
QODOn = "on"
end
local reply = user.sName..", the Quote of the Day script is now "..QODOn.."."
user:SendData(QODBot,reply)
return 1
elseif cmd == QODPmOn then
if QODPm == "on" then
QODPm = "off"
elseif QODPm == "off" then
QODPm = "on"
end
local reply = user.sName..", Display Quote of the Day in pm is now "..QODPm.."."
user:SendData(QODBot,reply)
return 1
end
return 1
end
end

function NewUserConnected(user,data)
QodCommands(user)
local day = tonumber(os.date("%j"))
if QOD[day] and QODOn == "on" then
local Quote = "\r\n\r\n\t"..string.rep("=",100).."\r\n\tToday "..
"is "..os.date("%B %d %Y").." and "..frmHub:GetHubName().."'s current "..
"time is "..os.date("%I:%M %p").."\r\n\t[ Quote Of The Day: ]\r\n\t\" "..QOD[day]..
"\r\n\t"..string.rep("=",100).."\r\n\r\n"
if QODPm == "on" then
user:SendPM(QODBot,Quote)
else
user:SendData(QODBot,Quote)
end
end
end

OpConnected = NewUserConnected

function QodCommands(user)
[COLOR=red] if QodUserCommands == 1 then[/COLOR]
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Show Today's QOD $<%[mynick]> "..QODCmd.."||")
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Toggle Quotes On/Off $<%[mynick]> "..QODEnable.."||")
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Toggle PM's On/Off$<%[mynick]> "..QODPmOn.."||")
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\List All QOD's $<%[mynick]> "..QODList.."||")
[COLOR=red] end[/COLOR]
end


C ya
Title:
Post by: kash? on 20 November, 2005, 12:54:45
u did not read the post correctly
I want all the commands in right click option
only to ops and only Quote of the day command
to others

Means only OPs have all the right click commands  :P

and also I just found that if I restart scripts or host
hub again, it again sets quotes in main, I want
it to make it permanently till it is changed using
command  

Regards
Title:
Post by: 6Marilyn6Manson6 on 20 November, 2005, 14:01:50
Sorry for me error, but I things this is what you want.

--
--QOD 1.0c LUA 5
--
--by Mutor The Ugly 9/18/05
--
--Requested by Northwind
--
-- Sends a 'Quote Of The Day' to new logins
-- Option to list all quotes in PM
-- Checks for existance of quote file alerts OpChat if OpChat enabled, all users if not.
-- Provides context menu.
--
-- +Changes from v1.0  9/18/05
-- +Changed display format of quote to that of request
--
-- +Changes from v1.0b  11/19/05 Requests by kash?
-- +Added option to toggle script on/off
-- +Added option to toggle PM's on/off
-- +Added new commands to context menu (right click)
--

--User Settings------------------------------------------------
QODFile = "QOD.dat"             --QOD file
QODList = "+listqod"            --List all QOD's in PM
QODCmd = "+qod"                 --Get Todays quote
QODEnable = "+qon"              --Toggle quotes on/off
QODOn = "on" --Quotes on at script start? "on"/"off"
QODPmOn = "+qpm" --Toggle display of quotes in pm on/off
QODPm = "off" --Should send in pm at script start? "on"/"off"
QODBot = frmHub:GetHubBotName() --QODBot name pulled from hub or use "custom name"
QodMenu = frmHub:GetHubName() --Menu name pulled from hub, uses hub name for menu
QodSubMenu ="Quote Of The Day" --Custom submenu
QodUserCommands = 1 -- Send usercommands at user on connect 1=on/0=off
QodOPCommands = 1 -- Send usercommands at OP on connect 1=on/0=off
--End User Settings--------------------------------------------

local timein=os.date("%B %d %Y")

function Main()
local f,e = io.open( QODFile, "r" )
if f then
        dofile(QODFile)
else
local QodFileErrMsg="\r\n\r\n\tFile Error: "..QODFile.." does not exist.\r\n"
if not (frmHub:GetOpChatName()) then
SendToOps(QODBot,QodFileErrMsg)
else
SendPmToOps(frmHub:GetOpChatName(),QODBot..QodFileErrMsg)
end
end
if QODBot ~= frmHub:GetHubBotName() then
frmHub:RegBot(QODBot, 1, "Quote Of The Day", "")
end
end

function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
local s,e,cmd = string.find(data, "^%b<>%s+(%p%w+)")
if cmd then
if cmd == QODCmd and QODOn == "on" then
local day = tonumber(os.date("%j"))
if QOD[day] then
local Quote = "\r\n\r\n\t"..string.rep("=",100).."\r\n\tToday "..
"is "..os.date("%B %d %Y").." and "..frmHub:GetHubName().."'s current "..
"time is "..os.date("%I:%M %p").."\r\n\t[ Quote Of The Day: ]\r\n\t\" "..QOD[day]..
"\r\n\t"..string.rep("=",100).."\r\n\r\n"
if QODPm == "on" then
user:SendPM(QODBot,Quote)
return 1
else
user:SendData(QODBot,Quote)
return 1
end
end
elseif cmd == QODList and user.bOperator then
local Quote = "\r\n\r\n"
for i,v in QOD do
Quote = Quote.."[Day #"..i.."] : "..v.."\r\n\r\n"
end
user:SendPM(QODBot,"\r\n\r\n"..string.rep("=",75).."[ Quotes Of The Day ]"..
string.rep("=",25)..Quote.."\r\n"..string.rep("=",75).."[ End Quote Listing ]"..string.rep("=",25).."\r\n")
return 1
elseif cmd == QODEnable and user.bOperator then
if QODOn == "on" then
QODOn = "off"
elseif QODOn == "off" then
QODOn = "on"
end
local reply = user.sName..", the Quote of the Day script is now "..QODOn.."."
user:SendData(QODBot,reply)
return 1
elseif cmd == QODPmOn and user.bOperator then
if QODPm == "on" then
QODPm = "off"
elseif QODPm == "off" then
QODPm = "on"
end
local reply = user.sName..", Display Quote of the Day in pm is now "..QODPm.."."
user:SendData(QODBot,reply)
return 1
end
return 1
end
end

function NewUserConnected(user,data)
QodUserCommands(user)
local day = tonumber(os.date("%j"))
if QOD[day] and QODOn == "on" then
local Quote = "\r\n\r\n\t"..string.rep("=",100).."\r\n\tToday "..
"is "..os.date("%B %d %Y").." and "..frmHub:GetHubName().."'s current "..
"time is "..os.date("%I:%M %p").."\r\n\t[ Quote Of The Day: ]\r\n\t\" "..QOD[day]..
"\r\n\t"..string.rep("=",100).."\r\n\r\n"
if QODPm == "on" then
user:SendPM(QODBot,Quote)
else
user:SendData(QODBot,Quote)
end
end
end

function OpConnected(user,data)
QodOPCommands(user)
local day = tonumber(os.date("%j"))
if QOD[day] and QODOn == "on" then
local Quote = "\r\n\r\n\t"..string.rep("=",100).."\r\n\tToday "..
"is "..os.date("%B %d %Y").." and "..frmHub:GetHubName().."'s current "..
"time is "..os.date("%I:%M %p").."\r\n\t[ Quote Of The Day: ]\r\n\t\" "..QOD[day]..
"\r\n\t"..string.rep("=",100).."\r\n\r\n"
if QODPm == "on" then
user:SendPM(QODBot,Quote)
else
user:SendData(QODBot,Quote)
end
end
end

function QodUserCommands(user)
if QodUserCommands == 1 then
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Show Today's QOD $<%[mynick]> "..QODCmd.."||")
end
end

function QodOPCommands(user)
if QodOPCommands == 1 then
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Show Today's QOD $<%[mynick]> "..QODCmd.."||")
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Toggle Quotes On/Off $<%[mynick]> "..QODEnable.."||")
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Toggle PM's On/Off$<%[mynick]> "..QODPmOn.."||")
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\List All QOD's $<%[mynick]> "..QODList.."||")
end
end

C ya
Title: Re: Day, time and quote
Post by: speedX on 29 October, 2006, 09:55:48
Quote from: Mutor on 18 September, 2005, 18:45:56
Changed the script to display quote per your original request. Example:


<[Botname]>

========================================================================
Today is September 18 2005 and YourHub's current time is 12:40 PM
Quote Of The Day:
" Quote of the day text displays here  "
========================================================================



--
--QOD 1.0b LUA 5  9/18/05
--
--by Mutor The Ugly
--
--Requested by Northwind
--
-- Sends a 'Quote Of The Day' to new logins
-- Option to list all quotes in PM
-- Checks for existance of quote file alerts OpChat if OpChat enabled, all users if not.
-- Provides context menu.
--
-- +Changes from v1.0  9/18/05
-- +Changed display format of quote to that of request
--

--User Settings------------------------------------------------
QODFile = "QOD.dat"             --QOD file
QODCmd = "+qod"                 --Get Todays quote
QODList = "+listqod"            --List all QOD's in PM
Bot = frmHub:GetHubBotName() --Bot name pulled from hub or use custom name
QodMenu = frmHub:GetHubName() --Menu name pulled from hub, uses hub name for menu
QodSubMenu ="Quote Of The Day" --Custom submenu
--End User Settings--------------------------------------------

local timein=os.date("%B %d %Y")

function Main()
local f,e = io.open( QODFile, "r" )
if f then
        dofile(QODFile)
else
local QodFileErrMsg="\r\n\r\n\tFile Error: "..QODFile.." does not exist.\r\n"
if not (frmHub:GetOpChatName()) then
SendToAll(Bot,QodFileErrMsg)
else
SendPmToOps(frmHub:GetOpChatName(),Bot..QodFileErrMsg)
end
end
if Bot ~= frmHub:GetHubBotName() then
frmHub:RegBot(Bot, 1, "Quote Of The Day", "")
end
end

function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
local s,e,cmd = string.find(data, "^%b<>%s+(%p%S+)")
if cmd and cmd == QODCmd then
local day = tonumber(os.date("%j"))
if QOD[day] then
user:SendData(Bot,"\r\n\r\n\t"..string.rep("=",100).."\r\n\tToday "..
"is "..os.date("%B %d %Y").." and "..frmHub:GetHubName().."'s current "..
"time is "..os.date("%I:%M %p").."\r\n\tQuote Of The Day:\r\n\t\" "..QOD[day]..
" \"\r\n\t"..string.rep("=",100).."\r\n\r\n")
end
return 1
elseif cmd and cmd == QODList then
local Quote = "\r\n\r\n"
for i,v in QOD do
Quote = Quote..v.."\r\n\r\n"
end
user:SendPM(Bot,"[Quotes Of The Day]\r\n\r\n"..Quote)
return 1
end
end

function NewUserConnected(user,data)
QodCommands(user)
local day = tonumber(os.date("%j"))
if QOD[day] then
user:SendData(Bot,"\r\n\r\n\t"..string.rep("=",100).."\r\n\tToday "..
"is "..os.date("%B %d %Y").." and "..frmHub:GetHubName().."'s current "..
"time is "..os.date("%I:%M %p").."\r\n\tQuote Of The Day:\r\n\t\" "..QOD[day]..
" \"\r\n\t"..string.rep("=",100).."\r\n\r\n")
end
end

OpConnected = NewUserConnected

function QodCommands(user)
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\Show Today's QOD $<%[mynick]> "..QODCmd.."||")
user:SendData("$UserCommand 1 3 "..QodMenu.."\\"..QodSubMenu.."\\List All QOD's $<%[mynick]> "..QODList.."||")
end



When i type +qod or +listqod it doesnt give any output. (I am using ptokax 0.3.5.1 lua 5.1, I converted it to 5.1 by mutor's app)