PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Re@SoN on 01 July, 2005, 20:35:00

Title: ascii intead of talking
Post by: Re@SoN on 01 July, 2005, 20:35:00
well guys, i have 1 ideia for my hub but i need help for that. :p

the ideia is:
that users would have a righclick menu with comands so they can talk by ascii draws...
what i would like to have is a script, with righclick menu, that reads the ascii draw from a directory inside ptokax\scripts...something like artbot 1.0 but with righclick menu :)

best regards,
Re@SoN
Title:
Post by: Loading on 01 July, 2005, 21:10:04
hi

you can put your own commands in right cliker menu

put art bot commands in there


best regards

Loading
Title:
Post by: Re@SoN on 02 July, 2005, 19:23:27
hi loading... ;)
i already think that, use the zrighclick script from robo to do that by puting some comands to the txt's...
but if that can be made my doughts are:

1? -  were do i have to put the asciis draws in way the script can read them..or do i have to create a new folder just to ascii draws....!?

2? -  the lines of code are the same to do that!?...

so i'm in a impass and need some help/advise..
if can be made in zrightclick and you or anyone knows how, plaese just post a example line and i'll do the rest...:)

[[[[]]]],
Re@SoN
Title:
Post by: Loading on 03 July, 2005, 19:42:56
hi

i'm working on it

:)


when i finish it i post here


best regards


Loading
Title:
Post by: ??????Hawk?????? on 03 July, 2005, 22:31:47
hi

Make a folder Within your scripts folder called  ' ascii   '
Fill that folder up with your Ascii files and restart the script..
Check the right click menu..







-- Yet another version AsciiTexter Bot
--  By ??????Hawk?????? 03/07/2005

AsciiBotName = "AsciiTexter" --// Set Bot name here

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)
curUser:SendData("$UserCommand 255 |") -- clear
for STCommand,q in AsciiTable do
curUser:SendData("$UserCommand 1 3 "..AsciiBotName.."\\"..STCommand.."$<%[mynick]> !"..STCommand.."||")
end
end

Have fun....

??????Hawk??????
Title:
Post by: Dessamator on 03 July, 2005, 22:49:43
hmm, well done hawk, very nice and neat , except for the extra end pipes, not needed
Title:
Post by: ??????Hawk?????? on 03 July, 2005, 22:59:05
QuoteOriginally posted by Dessamator
hmm, well done hawk, very nice and neat , except for the extra end pipes, not needed


Ive never touched a Pipe in my life..  i prefer the Smoother smoke of....   Ehem " Roll Your Own "  ( if you know what i mean )   ;)  ;)


ohh  and regardin the script  ..  yeh  maby i should have spent more time on it ..  say  at least   6 mins   :P

anyway  aint it your job to take a script and make it worthy of running  ??    :D  :D
Title:
Post by: Dessamator on 03 July, 2005, 23:49:00
my JOB?, yikes, hehe i have to start charging for it then, either way, the script is probably functional, but as plop once said, the "pipes" would cause errors with some dcs, :),  anyways, its far simpler for u to edit the script rather than for me to copy and paste it again !

as for smoking pipes, or rolling, dont do that, its bad for ur health just ask bastya, the doctor ! :)
Title:
Post by: Re@SoN on 04 July, 2005, 00:20:48
hi guys!
tks ??????Hawk?????? for helping me out by doing this script...i tested and works.  :]
but i would like to have something like this:

sMenu = "name of menu"

SendTo = { --> 1=on/0=off
Title:
Post by: ??????Hawk?????? on 04 July, 2005, 00:26:28


-- 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 = "AsciiTexter" --// Set Bot name here

[COLOR=blue]SendTo = { --> 1=on/0=off
[0] = 1, -- Masters
[1] = 1, -- Operators
[2] = 1, -- Vips
[3] = 1, -- Regs
[4] = 1, -- Moderator
[5] = 1, -- NetFounder
[-1] = 0, -- Users
} [/COLOR]  



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)
[COLOR=red]if SendTo[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
[COLOR=red]end[/COLOR]
end
Title:
Post by: Re@SoN on 04 July, 2005, 16:34:56
tks very much ??????Hawk?????? for helping me out, by making this script, it's just perfect for what i need  :D

i'm learning lua and this make me understand better "how to.."
and some day i'll post my fist script here(i hope)!


respectfully,
Re@SoN