Hi, all :]
I'm a newbie (bigtime he he) with scripting. I've been trying to get my helpfiles to open in a new popup window, and not in main (private message bla bla). The script i'm using looks like this:
Trigger = "!rules"
operatorFile = "rules.txt"
userFile = "rules.txt"
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, strlen(data)-1)
if (strfind(strlower(data), strlower(Trigger))) then
if (curUser.bOperator) then
ReadHelpFile(curUser, operatorFile)
else
ReadHelpFile(curUser, userFile)
end
end
end
end
function ReadHelpFile(curUser, theFile)
local handle = openfile(theFile, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
curUser:SendData(" " ..line)
line = read(handle)
end
closefile(handle)
end
end
I use the same script for getting different helpfiles, and it has to work with testdrive 4.99
I've downloaded script after script, but they all write the file in main, and not a new popup window... I've also tried (trial and error) changing some myself, but with no success :(
Could someone please help me with this one?
QuoteOriginally posted by Not
Hi, all :]
I'm a newbie (bigtime he he) with scripting. I've been trying to get my helpfiles to open in a new popup window, and not in main (private message bla bla). The script i'm using looks like this:
Trigger = "!rules"
operatorFile = "rules.txt"
userFile = "rules.txt"
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, strlen(data)-1)
if (strfind(strlower(data), strlower(Trigger))) then
if (curUser.bOperator) then
ReadHelpFile(curUser, operatorFile)
else
ReadHelpFile(curUser, userFile)
end
end
end
end
function ReadHelpFile(curUser, theFile)
local handle = openfile(theFile, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
curUser:SendData(" " ..line)
line = read(handle)
end
closefile(handle)
end
end
I use the same script for getting different helpfiles, and it has to work with testdrive 4.99
I've downloaded script after script, but they all write the file in main, and not a new popup window... I've also tried (trial and error) changing some myself, but with no success :(
Could someone please help me with this one?
Maybe try replase:
curUser:SendData(" " ..line)
with this
curUser:SendPrivateMessage(" " ..line)
curUser:SendPM(" " ..line)
thats the 1 to use
Wow, that was quick :)
No pop up window, tried both suggestions, but didn't work...
looks like this:
Trigger = "!test"
operatorFile = "test.txt"
userFile = "test.txt"
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, strlen(data)-1)
if (strfind(strlower(data), strlower(Trigger))) then
if (curUser.bOperator) then
ReadHelpFile(curUser, operatorFile)
else
ReadHelpFile(curUser, userFile)
end
end
end
end
function ReadHelpFile(curUser, theFile)
local handle = openfile(theFile, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
curUser:SendPM(" " ..line)
line = read(handle)
end
closefile(handle)
end
end
Does it matter that it's a privatehub with only regusers?
Here:
BotName = "-Txt-Bot-"
Trigger = "!test"
operatorFile = "test.txt"
userFile = "test.txt"
function Main()
frmHub:RegBot(BotName)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, strlen(data)-1)
if (strfind(strlower(data), strlower(Trigger))) then
if (curUser.bOperator) then
ReadHelpFile(curUser, operatorFile)
else
ReadHelpFile(curUser, userFile)
end
end
end
end
function ReadHelpFile(curUser, theFile)
local handle = openfile(theFile, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
curUser:SendPM(BotName, line)
line = read(handle)
end
closefile(handle)
end
end
Try this one....
Yups we forgot to do the (BotName) lol
Have a good 1
Wiiiiiiii! :D
The new one worked right away! Thanks a *lot*, guys!
Now it looks a lot more "proffessional", he he... 8)