Hi there me again ;D
I've been asked to convert this darn bot (a type of wishboard) and i dont know where i've gone wrong. No errors but it doesn't work either
botname = "HubBot"
bot_email = "HubBot@HELVETIA"
bot_speed = "GanjaLan(ThC)"
bot_descr = "Schreib #wunsch als PM an HubBot."
bot_share_size = 0 * 1024 *1024 *1024
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email
TimeSpanInMinutes = 360 --//Hier die Zeit eintragen
function Main()
frmHub:RegBot(botname)
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end
function NewUserConnected(curUser)
curUser:SendData( my_info_string )
end
function OpConnected(curUser)
curUser:SendData( my_info_string )
end
function OnTimer()
--//Notiere dass eine "|" die neue zeile ausradiert
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HIHO!!!!, Ich bin das hubinterne Wunschbrett.")
SendToAll(" Suchst du etwas bestimmtes???")
SendToAll(" W?nsche es!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" Um eine Datei zu w?nschen schreibe #wunsch Als PM")
SendToAll(" an HubBot. Versuche so genau wie m?glich zu sein.")
SendToAll(" Guck hier ?fters mal vorbei um zu sehen ob jemand die Datei hat f?r dich. PM mit !lesen an HubBot")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end
function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function DataArrival(user, data)
if(string.sub(data, 1, 4) == "$To:") then
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="#wunsch") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Dies ist Das hubinterne Wunschbrett!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Schreibe #wunsch um diese Hilfe zu lesen.")
user:SendPM(botname," Schreibe !wunsch <datei> um eine Datei zu w?nschen.")
user:SendPM(botname," Schreibe !lesen um gepostete W?nsche/Updates zu lesen.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Versuche so genau wie m?glich zu sein.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
elseif (cmd=="!wunsch") then
SendToAll("***Neuer Wunsch hinzugef?gt***")
arg= GetArgs(data)
local handle=openfile("request.dat","a")
write(handle,"("..user.sName..") sucht nach :"..arg.."?")
user:SendPM(botname,"Wunsch Eingabe gespeichert ....")
closefile(handle)
elseif (cmd=="!lesen") then
handle2=openfile("request.dat","r")
if (handle2==nil) then
else
line = read(handle2,"*a")
line=string.sub(line,1,string.len(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray[i])
end
closefile(handle2)
end
end
end
end
end
First of...
DataArrival should be ToArrival
and if(string.sub(data, 1, 4) == "$To:") then
and it's end can be removed
Now.. The file handling...
First of... Swear! and curse at filehandling ;) it's always been a bitch to convert...
instead of openfile we now use io.open
write(handle, "text") is changed to handle:write("text")
closefile:(handle) is now handle:close()
*** Side note, handle can be changed to anything, most ppl use file
Post your progress.... =)
*Edit*
Btw.. U missed a strfind...
And... Get it tabbed... ;p make's it easier to read...
TimeSpanInMinutes = 360 --//Hier die Zeit eintragen
function Main()
frmHub:RegBot("HubBot",1,"Schreib #wunsch als PM an HubBot." , "HubBot@HELVETIA")
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end
function OnTimer()
--//Notiere dass eine "|" die neue zeile ausradiert
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HIHO!!!!, Ich bin das hubinterne Wunschbrett.")
SendToAll(" Suchst du etwas bestimmtes???")
SendToAll(" W?nsche es!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" Um eine Datei zu w?nschen schreibe #wunsch Als PM")
SendToAll(" an HubBot. Versuche so genau wie m?glich zu sein.")
SendToAll(" Guck hier ?fters mal vorbei um zu sehen ob jemand die Datei hat f?r dich. PM mit !lesen an HubBot")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
string.gsub(inString, matcher, function (w) table.insert(_WORDS,w) end)
return _WORDS
end
function GetArgs(data)
local s,e,whoTo,from,cmd,arg,arg2 = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function ToArrival(user, data)
local s,e,whoTo = string.find(data,"$To:%s+(%S+)")
if (whoTo == botname) then
local s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="#wunsch") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Dies ist Das hubinterne Wunschbrett!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Schreibe #wunsch um diese Hilfe zu lesen.")
user:SendPM(botname," Schreibe !wunsch <datei> um eine Datei zu w?nschen.")
user:SendPM(botname," Schreibe !lesen um gepostete W?nsche/Updates zu lesen.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Versuche so genau wie m?glich zu sein.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
elseif (cmd=="!wunsch") then
SendToAll("***Neuer Wunsch hinzugef?gt***")
arg= GetArgs(data)
local file= io.open("request.dat","a+")
file:write(("..user.sName..") sucht nach :"..arg.."?")
user:SendPM(botname,"Wunsch Eingabe gespeichert ....")
file:close()
elseif (cmd=="!lesen") then
file2=io.open("request.dat","r")
if (file2==nil) then
else
line = io.read(handle2,"*a")
line=string.sub(line,1,string.len(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray[i])
end
io.close(file2)
end
end
end
end
That's my progress...not tested.
Well heres my go at it - everything works except the read bit - if i use the !lesen cmd the script crashes [ [21:11] Syntax ...\Desktop\0.3.4.0f0.Lua5.02.dbg\scripts\wunschbot.lua:83: bad argument #1 to `read' (invalid option) ]
Oh and i did a bit of tabbing (but it still looks like crap)
botname = "HubBot"
bot_email = "HubBot@HELVETIA"
bot_speed = "GanjaLan(ThC)"
bot_descr = "Schreib #wunsch als PM an HubBot."
bot_share_size = 0 * 1024 *1024 *1024
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email
TimeSpanInMinutes = 360 --//Hier die Zeit eintragen
function Main()
frmHub:RegBot(botname)
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end
function NewUserConnected(curUser)
curUser:SendData( my_info_string )
end
function OpConnected(curUser)
curUser:SendData( my_info_string )
end
function OnTimer()
--//Notiere dass eine "|" die neue zeile ausradiert
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HIHO!!!!, Ich bin das hubinterne Wunschbrett.")
SendToAll(" Suchst du etwas bestimmtes???")
SendToAll(" W?nsche es!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" Um eine Datei zu w?nschen schreibe #wunsch Als PM")
SendToAll(" an HubBot. Versuche so genau wie m?glich zu sein.")
SendToAll(" Guck hier ?fters mal vorbei um zu sehen ob jemand die Datei hat f?r dich. PM mit !lesen an HubBot")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end
function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function ToArrival(user, data)
if(string.sub(data, 1, 4) == "$To:") then
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="#wunsch") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Dies ist Das hubinterne Wunschbrett!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Schreibe #wunsch um diese Hilfe zu lesen.")
user:SendPM(botname," Schreibe !wunsch <datei> um eine Datei zu w?nschen.")
user:SendPM(botname," Schreibe !lesen um gepostete W?nsche/Updates zu lesen.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Versuche so genau wie m?glich zu sein.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
elseif (cmd=="!wunsch") then
SendToAll("***Neuer Wunsch hinzugef?gt***")
arg= GetArgs(data)
local file=io.open("request.dat","a")
file:write(""..user.sName.." sucht nach :"..arg.."?")
user:SendPM(botname,"Wunsch Eingabe gespeichert ....")
file:close()
elseif (cmd=="!lesen") then
file2=io.open("request.dat","r")
if (file2==nil) then
else
line = io.read(file2,"*a")
line=string.sub(line,1,string.len(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray[i])
end
file2:close()
end
end
end
end
end
Just as an addition to what has been said:
- linearray.n should be replaced with table.getn(linearray);
- There's no need to parse whoTo twice, as well as From:
Regarding Markitos' code:
- botname must be set, or else, the script won't "work";
- In !lesen command, to read all file's content it should be: file2:read("*all"); also, mind the file vars (file2 ~= handle2);
- In the same command, you should close the file with: file2:close();
- In !wunsch command, there should be a if to make sure that args exists;
- If you don't string.sub ToArrival's data, you must include the endpipe in your string.find's.
There are other things that could be changed, but, these are the critical ones.
Quote from: Psycho_Chihuahua on 22 April, 2006, 20:15:33
Well heres my go at it - everything works except the read bit - if i use the !lesen cmd the script crashes [ [21:11] Syntax ...\Desktop\0.3.4.0f0.Lua5.02.dbg\scripts\wunschbot.lua:83: bad argument #1 to `read' (invalid option) ]
Try this:
local line = file2:read("*all")
Quote from: jiten on 22 April, 2006, 20:25:33
Quote from: Psycho_Chihuahua on 22 April, 2006, 20:15:33
Well heres my go at it - everything works except the read bit - if i use the !lesen cmd the script crashes [ [21:11] Syntax ...\Desktop\0.3.4.0f0.Lua5.02.dbg\scripts\wunschbot.lua:83: bad argument #1 to `read' (invalid option) ]
Try this:
local line = file2:read("*all")
na this damn script still keeps crashing :(
[ :83: bad argument #1 to `read' (invalid option) ]
The good thing is that everything else works: as in - if no file request.dat is created -- wishes are saved to request.dat
but it just don't like reading it
Quote from: Psycho_Chihuahua on 22 April, 2006, 20:32:20
na this damn script still keeps crashing :(
[ :83: bad argument #1 to `read' (invalid option) ]
Regarding your code:
- In !lesen, replace
line = io.read(file2,"*a") with
local line = file2:read("*all");
- Again in !lesen, replace
linearray.n with
table.getn(linearray);
- In your tokenize function, replace
tinsert with
table.insert, and
gsub with
string.gsub.
thanks jiten that did the trick ;) it works fine now :o
They still dont work...
sBot = "Bot"
iTimeSpanInMinutes = 360 --//Hier die Zeit eintragen
function Main()
frmHub:RegBot(sBot,1,"Schreib #wunsch als PM an HubBot." , "HubBot@HELVETIA")
SetTimer(iTimeSpanInMinutes*33000)
StartTimer()
end
function OnTimer()
--//Notiere dass eine "|" die neue zeile ausradiert
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HIHO!!!!, Ich bin das hubinterne Wunschbrett.")
SendToAll(" Suchst du etwas bestimmtes???")
SendToAll(" W?nsche es!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" Um eine Datei zu w?nschen schreibe #wunsch Als PM")
SendToAll(" an HubBot. Versuche so genau wie m?glich zu sein.")
SendToAll(" Guck hier ?fters mal vorbei um zu sehen ob jemand die Datei hat f?r dich. PM mit !lesen an HubBot")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
string.gsub(inString, matcher, function (w) table.insert(_WORDS,w) end)
return _WORDS
end
function GetArgs(data)
local s,e,whoTo,from,cmd,arg,arg2 = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function ToArrival(user, data)
local s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+[%!%+](%S+)|$")
if whoTo == sBot then
if (cmd=="wunsc") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Dies ist Das hubinterne Wunschbrett!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Schreibe #wunsch um diese Hilfe zu lesen.")
user:SendPM(botname," Schreibe !wunsch <datei> um eine Datei zu w?nschen.")
user:SendPM(botname," Schreibe !lesen um gepostete W?nsche/Updates zu lesen.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Versuche so genau wie m?glich zu sein.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
elseif (cmd=="wunsch") then
SendToAll("***Neuer Wunsch hinzugef?gt***")
arg= GetArgs(data)
local file= io.open("request.dat","a+")
file:write(""..user.sName.." sucht nach :"..arg.."?")
user:SendPM(botname,"Wunsch Eingabe gespeichert ....")
file:close()
end
elseif (cmd=="lesen") then
file2=io.open("request.dat","r")
if (file2~=handle2) then
else
line =read("*all")
line=string.sub(line,1,string.len(line)-1)
linearray=tokenize(line,"?")
for i=1,table.getn(linearray) do
user:SendPM(botname,linearray[i])
end
file2:close()
end
end
end
This one works Markitos ;)
botname = "Wunschbrett"
bot_email = "HubBot@HELVETIA"
bot_speed = "GanjaLan(ThC)"
bot_descr = "Schreib #wunsch als PM an HubBot."
bot_share_size = 0 * 1024 *1024 *1024
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email
TimeSpanInMinutes = 360 --//Hier die Zeit eintragen in Minuten
function Main()
frmHub:RegBot(botname)
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..string.char( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end
function NewUserConnected(curUser)
curUser:SendData( my_info_string )
end
function OpConnected(curUser)
curUser:SendData( my_info_string )
end
function OnTimer()
--//Notiere dass eine "|" die neue zeile ausradiert
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HIHO!!!!, Ich bin das hubinterne Wunschbrett.")
SendToAll(" Suchst du etwas bestimmtes???")
SendToAll(" W?nsche es!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" Um eine Datei zu w?nschen schreibe #wunsch Als PM")
SendToAll(" an HubBot. Versuche so genau wie m?glich zu sein.")
SendToAll(" Guck hier ?fters mal vorbei um zu sehen ob jemand die Datei hat f?r dich. PM mit !lesen an HubBot")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
string.gsub(inString, matcher, function (w) table.insert(_WORDS,w) end)
return _WORDS
end
function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function ToArrival(user, data)
if(string.sub(data, 1, 4) == "$To:") then
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="#wunsch") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Dies ist Das hubinterne Wunschbrett!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Schreibe #wunsch um diese Hilfe zu lesen.")
user:SendPM(botname," Schreibe !wunsch <datei> um eine Datei zu w?nschen.")
user:SendPM(botname," Schreibe !lesen um gepostete W?nsche/Updates zu lesen.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Versuche so genau wie m?glich zu sein.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname,"Alle Befehle an den Wunschbrett Bot sind als PM senden")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
elseif (cmd=="!wunsch") then
SendToAll("***Neuer Wunsch hinzugef?gt***")
arg= GetArgs(data)
local file=io.open("request.dat","a")
file:write(""..user.sName.." sucht nach :"..arg.."?")
user:SendPM(botname,"Wunsch Eingabe gespeichert ....")
file:close()
elseif (cmd=="!lesen") then
file2=io.open("request.dat","r")
if (file2==nil) then
else
local line = file2:read("*all");
line=string.sub(line,1,string.len(line)-1)
linearray=tokenize(line,"?")
for i=1,table.getn(linearray) do
user:SendPM(botname,linearray[i])
end
file2:close()
end
end
end
end
end
i'm busy translating it to englisch now ;)
Yes i know...but in order to learn i must code in my own style, create bugs and fix 'em :)
true, ok then i will wait with my one ;)
by the way in this script cmd's are to be posted as PM to the bot
Quote from: Psycho_Chihuahua on 22 April, 2006, 22:30:20
true, ok then i will wait with my one ;)
by the way in this script cmd's are to be posted as PM to the bot
Yes i know, that's why ToArrival exists ;)
;D well yours works too