sup
i got release bot for lua 5 and using RC10b and Ptokax 16.09 and i want the releases to come in PM when someone connects if u understand so wen i connect it pops up im pm with all the releases. thank you
Maybe if u posted the script, it'd be easier for us to help u.
Btw, i recommend u using FreshStuff (http://board.univ-angers.fr/thread.php?threadid=3893&boardid=26&sid=be2c111c27b2ddad011aaa311d83189b). There u had only to change this value:
-- Show latest stuff on entry 1=yes, 0=no
ShowOnEntry = 1
Cheers
kool here is the -- -- Verry simple release script nothing fancy
-- Make a file called releases.txt in \Scripts Folder
-- Made By Optimus
-- Converted the script into LUA 5 by 6Marilyn6Manson6
-- Filehandling problem fixed by Madman
sBot = "??w-??wR?l????'?"
timedate = os.date()
file = "releases.txt"
display1 = "Item"
display2 = "Description"
display3 = "Releases"
function Main()
frmHub:RegBot(sBot)
end
function ChatArrival(user, data)
if (string.sub(data, 1, 1) == "<" ) then
data=string.sub(data,1,string.len(data)-1)
_,_,cmd=string.find(data, "%b<>%s+(%S+)")
if (cmd=="+new") then
ReadRelease(user, data, cmd)
return 1
elseif (cmd=="+add") then
if user.bOperator or user.iProfile == 2 then
s,e,cmd,release,desc = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
if desc == nil then
description = "No "..display2.." specified!"
s,e,cmd,release = string.find( data, "%b<>%s+(%S+)%s+(%S+)" )
else
description = desc
end
if release == nil then
user:SendData(sBot, "*** No "..display1.." specified!")
return 1
end
News("By: "..user.sName.."\t Date: "..timedate.."\r\n"..display1..": "..release.."\r\n"..display2..": "..description.."\r\n")
SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type +new in Main-Chat to show "..display1..".")
return 1
else
user:SendData(sBot, "*** +add is only availible to [VIP] and above!")
return 1
end
end
end
end
function ReadRelease(user, data, cmd)
local release = ""
-- readfrom(file)
local file = io.input(file);
while 1 do
local line = io.read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
user:SendPM(sBot, "\r\n\r\n".." "..display3.."s posted by users: ".."\r\n\r\n"..release)
-- readfrom()
file:read()
end
function News(what)
-- appendto(file)
-- write(what.."\n")
-- writeto()
local file = io.open(file, "a+") -- "a+"
file:write(what.."\n")
file:close()
end
Try this one:
-- Verry simple release script nothing fancy
-- Make a file called releases.txt in \Scripts Folder
-- Made By Optimus
-- converted to Lua 5 by jiten
-- Added: Sending releases on connect to every user
-- Thanks do Dessamator for dealing with the table handling
tTable= {}
sBot = "=ReleaseBot="
timedate = os.date()
file = "releases.txt"
display1 = "Item"
display2 = "Description"
display3 = "Releases"
function Main()
frmHub:RegBot(sBot)
SetTimer(1)
StartTimer()
end
function ChatArrival(user, data)
data=string.sub(data,1,string.len(data)-1)
_,_,cmd=string.find(data, "%b<>%s+(%S+)")
if (cmd=="!read") then
ReadRelease(user, data, cmd)
return 1
elseif (cmd=="!write") then
if user.bOperator or user.iProfile == 2 then
s,e,cmd,release,desc = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
if desc == nil then
description = "No "..display2.." specified!"
s,e,cmd,release = string.find( data, "%b<>%s+(%S+)%s+(%S+)" )
else
description = desc
end
if release == nil then
user:SendData(sBot, "*** No "..display1.." specified!")
return 1
end
News("By: "..user.sName.."\t Date: "..timedate.."\r\n"..display1..": "..release.."\r\n"..display2..": "..description.."\r\n")
SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type !read in Main-Chat to show "..display1..".")
return 1
else
user:SendData(sBot, "*** !write is only available to [VIP] and above!")
return 1
end
end
end
function NewUserConnected(user,data)
tTable[user.sName] = {}
tTable[user.sName]["t"] = "1"
end
OpConnected = NewUserConnected
function News(what)
local h = io.open(file, "a+")
if h then
h:write(what.."\n")
h:close()
else
user:SendPM(sBot,file.." doesn't exist")
end
end
function ReadRelease(user, data, cmd)
local release = ""
local f = io.open(file, "r")
if f then
while 1 do
local line = f:read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
f:close()
msg = ("\r\n\r\n".." "..display3.."s posted by users: ".."\r\n\r\n"..release)
user:SendPM(sBot,msg)
else
user:SendPM(sBot,file.." doesn't exist")
end
end
function OnTimer()
local release = ""
local f = io.open(file, "r")
if f then
while 1 do
local line = f:read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
f:close()
msg = ("\r\n\r\n".." "..display3.."s posted by users: ".."\r\n\r\n"..release)
local i,v
for i,v in tTable do
score = tTable[i]["t"]
score = score - 1
tTable[i]["t"] =score
if tTable[i]["t"] == 0 then
GetItemByName(i):SendPM(sBot,msg)
end
end
end
end
*EDIT* Less "PtokaX like" eheh
Cheers
Hmmm didn't work
Firstly, add a release and then reconnect.
It u did it correctly, something like this will popup when reconnecting:
[15:16] <=ReleaseBot=>
Releasess posted by users:
By: jiten Date: 04/07/05 15:15:26
Item: Test
Description: No Description specified!
If u didn't, this will appear:
[15:15] <=ReleaseBot=> releases.txt doesn't exist
Cheers
nah i did do it right i added something then when i reconect nothing happen nothing ops up
pops* up
hello????
acctually it comes up but not in PM it comes up in mainchat before the MOTD and all that.
Thank You
biggam: you can edit your posts too ,.. prevents post mologue ;)
QuoteOriginally posted by biggam
acctually it comes up but not in PM it comes up in mainchat before the MOTD and all that.
Thank You
jiten: this sounds like a PtokaX way to do things. First let the scripts do their stuff and then PtokaX shall do its own.. and because you are sending the data on NewUserConnected it comes up before the MOTD and stuff ..
okay... so wat should i do...
Quotejiten: this sounds like a PtokaX way to do things. First let the scripts do their stuff and then PtokaX shall do its own.. and because you are sending the data on NewUserConnected it comes up before the MOTD and stuff ..
I understood the NewUserConnected and data coming up before MOTD part but, I still got some doubts how to mod this script so that it wouldn't happen in case I used SendData.
Can u explain/show it so that I could learn a bit more?
Who you asking me or Herodes? kool
QuoteOriginally posted by biggam
Who you asking me or Herodes? kool
Herodes... :D
Maybe putting the messages and the nick in a table with a predifined countdown. reading through the following script may give you the idea I am trying to pass..
tTable= {
["nick_of_user"] = { ["timeleft"] = 5, ["msg"] = "data to send" },
}
Bot = "thenameofthebot"
function Main()
SetTimer(1000)
StartTimer()
end
function OnTimer()
for i,v in tTable do
v.timeleft = v.timeleft-1
if v.timeleft == 0 then
SendToNick( i, "thenameofthebot", v.msg )
tTable[i] = nil;
end
end
end
yo man can't you just give me a script that is a release bot that will come up in Private message on connect to every user profile. thank you.
btw the script you already gave me worked once then when i reconect it came up before the MOTD and it says private message from release bot :...... but in maint chat.
:]
QuoteOriginally posted by biggam
yo man can't you just give me a script that is a release bot that will come up in Private message on connect to every user profile. thank you.
btw the script you already gave me worked once then when i reconect it came up before the MOTD and it says private message from release bot :...... but in maint chat.
:]
First post updated.
Btw, have u ticked "Popup messages from users that are not online" and unticked "Ignore messages from users that are not online" in File - Settings - Advanced ?
Maybe, that's the reason for the private messages to appear in main chat.
Cheers