PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Nafigs on 04 November, 2003, 14:52:43

Title: PLZ help me with this one
Post by: Nafigs on 04 November, 2003, 14:52:43
Whell, i was trying to make a script, there is no syntax error, but he just not working:( can you please tell where is a problem in this one???







BotName="CauruleBot"

commandlinkhelp="!linkhelp"

function Showlinkhelp(target)
target:SendData(BotName,"*** This one is a link bot ***")
target:SendData(BotName,"")
target:SendData(BotName,"!crack: Crack links")
target:SendData(BotName,"!movie: Movie links")
target:SendData(BotName,"")
end

if ("cmd=!crack") then
readfrom("cracklinks.txt")
end

if ("cmd=!movie") then
readfrom("movielinks.txt")
end




Title:
Post by: pHaTTy on 04 November, 2003, 14:57:48
\first of all you need a data arrival, go check in the HOW-TO's i have lessons on writing a bot, go check ;)
Title:
Post by: pHaTTy on 04 November, 2003, 15:01:27
here is how it wud be ;)

BotName="CauruleBot"

commandlinkhelp="!linkhelp"

function Showlinkhelp(user)
user:SendData(BotName,"*** This one is a link bot ***")
user:SendData(BotName,"")
user:SendData(BotName,"!crack: Crack links")
user:SendData(BotName,"!movie: Movie links")
user:SendData(BotName,"")
end


function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")

if (cmd == "!crack") then
readfrom("cracklinks.txt")

elseif (cmd == "!movie") then
readfrom("movielinks.txt")

elseif (cmd == commandlinkhelp) then
Showlinkhelp(user)
end
end
end


l8rr,,

-phatty
Title:
Post by: pHaTTy on 04 November, 2003, 15:03:04
im not actually sure that user:SendData BotName,"") will work, it becomes nil i think maybe a space

user:SendData(BotName," ")
Title:
Post by: Nafigs on 04 November, 2003, 15:08:30
WOW:)))

Thanks gonna check out whrite now!!!
Sorry about my english:)
Title:
Post by: Nafigs on 04 November, 2003, 15:13:53
Whell only the !linkhelp command is working, but he don't what to read from movielinks.txt and cracklinks.txt files:(

I made them and placed in the scripts directory, but.......:(
Title:
Post by: pHaTTy on 04 November, 2003, 15:16:42
heheh it is reading the file just not sending it hehehe

BotName="CauruleBot"

commandlinkhelp="!linkhelp"

function Showlinkhelp(user)
user:SendData(BotName,"*** This one is a link bot ***")
user:SendData(BotName,"")
user:SendData(BotName,"!crack: Crack links")
user:SendData(BotName,"!movie: Movie links")
user:SendData(BotName,"")
end


function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")

if (cmd == "!crack") then
readfrom("cracklinks.txt")
WhileRead(user)

elseif (cmd == "!movie") then
readfrom("movielinks.txt")
WhileRead(user)

elseif (cmd == commandlinkhelp) then
Showlinkhelp(user)
end
end
end



function WhileRead(user)
while 1 do
line = read()
if line == nil then break end
user:SendData(BotName,line)
end
readfrom()
end

l8rr,,

-phatty
Title:
Post by: Nafigs on 04 November, 2003, 15:32:37
I don't know how to thank you:)))

Working perfect:)

Maybe putt this one in the threads? Actually this is a nice idea, because ussualy every body in the hubs asking for new movies or game cracks, and this one can be updeited with searial maybe or music, MP3:)))


http://caurule.netfirms.com
Title:
Post by: pHaTTy on 04 November, 2003, 15:41:19
There is a script that does all of that already ;)
Title:
Post by: Nafigs on 04 November, 2003, 15:44:09
Whell ok ok:)))

Just didn't know about that .