hi folks!
can anyone help me with this script plz...
the problem is:
when i config the reg profile to "1" in "SendTo = ", the right click menu don't appear to reg users like it should be...in others profiles it works(vip, op, netfounder,etc).
if anyone could help i'll be apreciated. :) ;)
tks!
-- Yet another version AsciiTexter Bot
-- By ??????Hawk?????? 03/07/2005
-- Create an ascii folder within the scripts folder and copy all your ascii files in.
AsciiBotName = " M ? ? ? ? - ? ? ? ? ? ? ?" --// Set Bot name here
SendTo = { --> 1=on/0=off
[0] = 0, -- Masters
[1] = 1, -- Operators
[2] = 1, -- Vips
[COLOR=red][3] = 1, -- Regs [/COLOR]
[4] = 0, -- Moderator
[5] = 1, -- NetFounder
[-1] = 0, -- Users
}
function ChatArrival(curUser, data)
data = string.sub(data,1,string.len(data)-1)
local _,_,PRFX,text = string.find( data, "%b<>%s+(%S)(%S+).*" )
if PRFX == Prefix and text and AsciiTable[text] then
local handle,Er = io.open("ascii/"..text..".txt", "r")
if handle then
local line = handle:read("*l")
TempAsciifile = "\r\n"
while line do
TempAsciifile = TempAsciifile.."\r\n"..line
line =handle:read("*l")
end
handle:close()
end
SendToAll(AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
return 1
end
end
function Main()
Prefix = "!"
AsciiTable = {}
local sDirectory = "ascii"
local sFileName = "Alisting.txt"
local sLine = nil;
os.execute("dir /b /a-d \""..sDirectory.."\" > \""..sFileName.."\"");
local ahFile,e = io.open(sFileName,"r")
sLine = ahFile:read("*l");
sLine = string.sub(sLine, 1, (string.len(sLine)-4))
AsciiTable[sLine] = 1
while ( sLine ) do
sLine = ahFile:read("*l");
if sLine ~= nil then
sLine = string.sub(sLine, 1, (string.len(sLine)-4))
AsciiTable[sLine] = 1
end
end
ahFile:close()
os.remove(sFileName);
end
NewUserConnected = OpConnected
function OpConnected(curUser)
if SendTo[curUser.iProfile] == 1 then
curUser:SendData("$UserCommand 255 ") -- clear
for STCommand,q in AsciiTable do
curUser:SendData("$UserCommand 1 3 "..AsciiBotName.."\\"..STCommand.."$<%[mynick]> !"..STCommand.."|")
end
end
end
best regards,
Re@SoN
tks a lot Mutor!...;)
with that simple line in the end...now works!!! :)
best regards,
Re@SoN
hi!
it's also possible to put that script, acepting special caracters, like spaces?...because i need to use them in the names of the txt files...
whem i put a space or someone other special caracter on the name of any txt file the script simply don't read the file.
best regards,
Re@SoN
hi!
Mutor, i change the line you said, but still keeping not acepting spaces in the name of txt files...
i tried to chaged the prefix, and use several other diferent carecters, and nothing...now the comand apeears in mainchat but the ascii don't apeear...
i'm using robo and 2 other scripts with rightclick menu, can it be for that reason!?
i just like to use spaces, nothing more.
for ex. i want to put 1 of the txt file with this name: Links de diversao
and the txt file shows the ascii with the links.
function ChatArrival(curUser, data)
data = string.sub(data,1,string.len(data)-1)
[COLOR=red] local _,_,PRFX,text = string.find( data, "^%b<>%s+(%p)(.+)$" )[/COLOR]
if PRFX == Prefix and text and AsciiTable[text] then
local handle,Er = io.open("ascii/"..text..".txt", "r")
if handle then
local line = handle:read("*l")
TempAsciifile = "\r\n"
while line do
TempAsciifile = TempAsciifile.."\r\n"..line
line =handle:read("*l")
end
handle:close()
end
SendToPm(AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
return 1
end
end
hi!
sorry Mutor for spending your pacience... i changed the line.
but still not working, this is the error that apeears in ptokax:
scripts\AsciiTexter.lua:23: invalid capture index
i'm not typing the txt extention...
like in the other times, i try to execute the comands by right click menu that triggs the txt files...and not typing the comand by main. if is that you want to mean..
sorry for my ignorance, but if you still have the pacience to trying solve the error, i'll be greatfull.
best regrads,
Re@SoN
hi!
Mutor, now work perfectly!!!
an excelent work...
tks a lot! :] ;)
but only now that i tested the script, i figured out that floods me the main...:S
and that i haven't thinking befor....lol
i try my self to change the script so the msg can apear in pvt but didn't make it.
for the script do that, i think that the change it's minimum, maybe something like SendToPm, but here i change that...i don't know....i've tried in here:
function OpConnected(curUser)
[COLOR=red] if SendToPm[curUser.iProfile] == 1 then [/COLOR]
curUser:SendData("$UserCommand 255 ") -- clear
for STCommand,q in AsciiTable do
curUser:SendData("$UserCommand 1 3 "..AsciiBotName.."\\"..STCommand.."$<%[mynick]> !"..STCommand.."|")
end
end
end
since i don't now lua, was by atempts..:)
best regards,
Re@SoN
humm..now i understand...after all, i was far away to solved the probl...heh
copy,paste, like in here:
error:scripts\AsciiTexter.lua:67: attempt to index global `user' (a nil value)
and this time i don't even tryed to fix it...i only have some notions about lua, but i'm always learning...:)
Best regards,
Re@SoN
QuoteOriginally posted by Re@SoN
humm..now i understand...after all, i was far away to solved the probl...heh
copy,paste, like in here:
error:scripts\AsciiTexter.lua:67: attempt to index global `user' (a nil value)
and this time i don't even tryed to fix it...i only have some notions about lua, but i'm always learning...:)
Best regards,
Re@SoN
Try this:
-- Yet another version AsciiTexter Bot
-- By ??????Hawk?????? 03/07/2005
-- Create an ascii folder within the scripts folder and copy all your ascii files in.
-- error:scripts\AsciiTexter.lua:67: attempt to index global `user' (a nil value) / fixed by 6Marilyn6Manson6
AsciiBotName = "ASCII-Reader" --// Set Bot name here
SendTo = { --> 1=on/0=off
[0] = 0, -- Masters
[1] = 1, -- Operators
[2] = 1, -- Vips
[3] = 1, -- Regs
[4] = 0, -- Moderator
[5] = 1, -- NetFounder
[-1] = 0, -- Users
}
function Main()
if AsciiBotName ~= frmHub:GetHubBotName() then
frmHub:RegBot(AsciiBotName, 1, "ASCII Reader bot", "")
end
Prefix = "?"
AsciiTable = {}
local sDirectory = "ascii"
local sFileName = "Alisting.txt"
local sLine = nil;
os.execute("dir /b /a-d \""..sDirectory.."\" > \""..sFileName.."\"");
local ahFile,e = io.open(sFileName,"r")
sLine = ahFile:read("*l");
sLine = string.sub(sLine, 1, (string.len(sLine)-4))
AsciiTable[sLine] = 1
while ( sLine ) do
sLine = ahFile:read("*l");
if sLine ~= nil then
sLine = string.sub(sLine, 1, (string.len(sLine)-4))
AsciiTable[sLine] = 1
end
end
ahFile:close()
os.remove(sFileName);
end
function OpConnected(curUser)
if SendTo[curUser.iProfile] == 1 then
curUser:SendData("$UserCommand 255 ") -- clear
for STCommand,q in AsciiTable do
curUser:SendData("$UserCommand 1 3 "..AsciiBotName.."\\"..STCommand.."$<%[mynick]> !"..STCommand.."|")
end
end
end
NewUserConnected = OpConnected
function ChatArrival(curUser, data)
data = string.sub(data,1,string.len(data)-1)
local _,_,prefix,text = string.find( data, "%b<>%s+(%p)(.+)" )
if prefix == Prefix and text and AsciiTable[text] then
local handle,error = io.open("ascii/"..text..".txt", "r")
if handle then
local line = handle:read("*l")
TempAsciifile = "\r\nDisplaying "..text..".txt:\r\n"
while line do
TempAsciifile = TempAsciifile.."\r\n"..line
line =handle:read("*l")
end
handle:close()
end
curUser:SendPM (AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
return 1
end
end
C ya
hi!
6Marilyn6Manson6, don't work...the same error in line 67:
NewUserConnected = OpConnected
function ChatArrival(curUser, data)
data = string.sub(data,1,string.len(data)-1)
local _,_,prefix,text = string.find( data, "%b<>%s+(%p)(.+)" )
if prefix == Prefix and text and AsciiTable[text] then
local handle,error = io.open("ascii/"..text..".txt", "r")
if handle then
local line = handle:read("*l")
TempAsciifile = "\r\nDisplaying "..text..".txt:\r\n"
while line do
TempAsciifile = TempAsciifile.."\r\n"..line
line =handle:read("*l")
end
[COLOR=red]handle:close() [/COLOR]
end
user:SendPM (AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
return 1
end
end
i iven tryed without spaces in the names off the txt files...just in case...
best regards,
Re@SoN
QuoteOriginally posted by Mutor
This
[COLOR=red]user:SendPM [/COLOR](AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
Should be this
[COLOR=red]curUser:SendPM[/COLOR](AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
Yeah Mutor.. infact in my post I have change only this line
User:SendPM (AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
with
curUser:SendPM (AsciiBotName, "<"..curUser.sName..">\r\n"..TempAsciifile)
LoL c ya
QuoteOriginally posted by Mutor
I know
Okiz.. nice :p
hi guys!
now works better than great...iven accept special charachters in the name(i tested)...better than this is impossible!!!
tks 6Marilyn6Manson6 and specially you Mutor, for all the help you guys give me with the script! :)) ;)
Best regards,
Re@SoN
QuoteOriginally posted by Re@SoN
hi guys!
now works better than great...iven accept special charachters in the name(i tested)...better than this is impossible!!!
tks 6Marilyn6Manson6 and specially you Mutor, for all the help you guys give me with the script! :)) ;)
Best regards,
Re@SoN
Welcome Re@SoN... we are here for help all :D
Nice script, Can you plz make it without prefix
I dont want prefix actually
Regards
actually i am in search of a script kalled ascii bot.. there are many ascii arts in it.. eg. explode. on clicking on explode in right click menu, an ascii of explosion is seen on the main chat and below it "..Nick.." just exploded !
Quote from: [ vAiBhAv?] on 31 May, 2009, 13:33:16
actually i am in search of a script kalled ascii bot.. there are many ascii arts in it.. eg. explode. on clicking on explode in right click menu, an ascii of explosion is seen on the main chat and below it "..Nick.." just exploded !
1. If you use the Search Function of this Forum wisely you WILL find what you are looking for
2. and more important: Think about upgrading your hub to the new API and you will most surely find what you seek
thats all i have to say