Can somebody make me a script with one command:
!diner1
If you type that there should appear a message in pm with some tekst in it
I want to change the tekst and want to putt the tekst file in a folder.
Uses a bot
I want that i can change the folder name and the bot name.
thx in advanced
QuoteOriginally posted by Syphrone-NL
Can somebody make me a script with one command:
!diner1
If you type that there should appear a message in pm with some tekst in it
I want to change the tekst and want to putt the tekst file in a folder.
Uses a bot
I want that i can change the folder name and the bot name.
thx in advanced
Have you searched in Lua 5 Request/Help with and Finished Scripts Section? I've seen scripts that do that there.
Cheers
Cant find it you got a link
Something like this (http://board.univ-angers.fr/thread.php?threadid=4352&boardid=28&styleid=1&sid=4ee1ebb0cec56bd7026a82c4f31a7a8e).
Cheers
Almost
One little thing
I got the tekst file in a folder so can you add that folder thing to it please
So i need to fill in the folder and fill in the name of the tekst file
Or get guarding as it does exactly what you want + more
got robocop and i only need that script
Try this too:
-- rules by jiten
sConf = {
sBot = frmHub:GetHubBotName(),
sFile1 = "diner1.txt",
sFolder = "txt" -- folder where the file is stored
}
function Main()
frmHub:RegBot(sConf.sBot)
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner1"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ReadFile(file)
local fFile = io.open(sConf.sFolder.."/"..file)
if fFile then
local message = fFile:read("*all");
fFile:close();
return message;
else
return file.." not found!"
end
end
Best regards
thx alot
You're welcome...
got an error when i want i do !dinner1
Syntax ...oftware\0.3.3.0.b16.09.nt.dbg\scripts\onecommand.lua:35: bad argument #2 to `sub' (number expected, got string)
How do i fix that
Bug fixed. Copy the script again.
Where's my head at? :D
Cheers
weird now i dont get anything
Post updated ;)
Finally its works great
I tryed now seven commands lol for fun
I tryed this:
sConf = {
sBot = frmHub:GetHubBotName(),
sFile1 = "diner1.txt",
sFile2 = "diner1.txt",
sFile3 = "diner1.txt",
sFile4 = "diner1.txt",
sFile5 = "diner1.txt",
sFile6 = "diner1.txt",
sFile7 = "diner1.txt",
sFolder = "txt" -- folder where the file is stored
}
function Main()
frmHub:RegBot(sConf.sBot)
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner7"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile7))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner1"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner2"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile2))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner3"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile3))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner4"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile4))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner5"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile5))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner6"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile6))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ReadFile(file)
local fFile = io.open(sConf.sFolder.."/"..file)
if fFile then
local message = fFile:read("*all");
fFile:close();
return message;
else
return file.." not found!"
end
end
But that doesnt work
Maybe some can tell my why???
I think because i dont know how make a script
QuoteOriginally posted by Syphrone-NL
But that doesnt work
Maybe some can tell my why???
I think because i dont know how make a script
well, uve answered the question by urself, "I think because i dont know how make a script", u cant just make a new ChatArrival for each command u add, it just doesnt work that way, :)
Can you help me a little bit forward???
Change ur code to this pattern:
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner1"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
end,
...
["diner7"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile7))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
Cheers
Cool got it
sConf = {
sBot = frmHub:GetHubBotName(),
sFile1 = "diner1.txt",
sFile2 = "diner1.txt",
sFile3 = "diner1.txt",
sFile4 = "diner1.txt",
sFile5 = "diner1.txt",
sFile6 = "diner1.txt",
sFile7 = "diner1.txt",
sFolder = "txt" -- folder where the file is stored
}
function Main()
frmHub:RegBot(sConf.sBot)
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner1"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
end,
["diner2"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile2))
end,
["diner3"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile3))
end,
["diner4"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile4))
end,
["diner5"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile5))
end,
["diner6"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile6))
end,
["diner7"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile7))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ReadFile(file)
local fFile = io.open(sConf.sFolder.."/"..file)
if fFile then
local message = fFile:read("*all");
fFile:close();
return message;
else
return file.." not found!"
end
end
Nice to know it.
Cheers
PS: I'd be better for u use to use the Rotating Message script if you wanted them to be posted after x minutes.
The rotating message is for a 24 hour rotating so after 24 hours there comes 1 tekst file with a message for a meal in it how to make the meal. But if the users want to see the meal on a other time they use that script
Can somebody make me a little thing in the little script that if somebody uses the command his nick and the command he used are send to opchat also
Can somebody make me a little thing in the little script that if somebody uses the command his nick and the command he used are send to opchat also
script
sConf = {
sBot = frmHub:GetHubBotName(),
sFile1 = "diner1.txt",
sFile2 = "diner1.txt",
sFile3 = "diner1.txt",
sFile4 = "diner1.txt",
sFile5 = "diner1.txt",
sFile6 = "diner1.txt",
sFile7 = "diner1.txt",
sFolder = "txt" -- folder where the file is stored
}
function Main()
frmHub:RegBot(sConf.sBot)
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner1"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
end,
["diner2"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile2))
end,
["diner3"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile3))
end,
["diner4"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile4))
end,
["diner5"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile5))
end,
["diner6"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile6))
end,
["diner7"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile7))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ReadFile(file)
local fFile = io.open(sConf.sFolder.."/"..file)
if fFile then
local message = fFile:read("*all");
fFile:close();
return message;
else
return file.." not found!"
end
end
QuoteOriginally posted by Syphrone-NL
Can somebody make me a little thing in the little script that if somebody uses the command his nick and the command he used are send to opchat also
script
sConf = {
sBot = frmHub:GetHubBotName(),
sFile1 = "diner1.txt",
sFile2 = "diner1.txt",
sFile3 = "diner1.txt",
sFile4 = "diner1.txt",
sFile5 = "diner1.txt",
sFile6 = "diner1.txt",
sFile7 = "diner1.txt",
sFolder = "txt" -- folder where the file is stored
}
function Main()
frmHub:RegBot(sConf.sBot)
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["diner1"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
end,
["diner2"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile2))
end,
["diner3"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile3))
end,
["diner4"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile4))
end,
["diner5"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile5))
end,
["diner6"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile6))
end,
["diner7"] = function(user,data)
user:SendPM(sConf.sBot,ReadFile(sConf.sFile7))
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
end
end
function ReadFile(file)
local fFile = io.open(sConf.sFolder.."/"..file)
if fFile then
local message = fFile:read("*all");
fFile:close();
return message;
else
return file.." not found!"
end
end
I didn't understand...Can u explain better???
If a user types !diner1 he gets a message in pm with a tekst
But i want that if the user uses that that the bot also sends a message to opchat with something like:
[user] uses the command !diner1
QuoteOriginally posted by Syphrone-NL
If a user types !diner1 he gets a message in pm with a tekst
But i want that if the user uses that that the bot also sends a message to opchat with something like:
[user] uses the command !diner1
Something like !cmdspy in Robocop, isn't it?
Change this part:
if tCmds[cmd] then
return tCmds[cmd](user,data), 1
end
with:
if tCmds[cmd] then
return tCmds[cmd](user,data), SendPmToOps(frmHub:GetOpChatName(),os.date().." - "..user.sName.." used command !"..cmd), 1
end
Btw, have a look at Rotating Message. It's more efficient and complete now (this code has a lot of repetition).
Cheers