PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Ubikk on 21 May, 2005, 12:48:20

Title: converting some little scripts part1 :)
Post by: Ubikk on 21 May, 2005, 12:48:20
Hi there. I have some old scripts and i would apreciate if someone would help me to convert them to lua 5.

The first one is a slap bot.
if command is "!slap robotzel" then the following text should appear in mainchat:

***Ubikk slaps robotzel with love ...

The second script is the "Custom Log in Script Made By Madman"
Here is the code:

--//Custom Log in Script Made By Madman

--//Thanks Typhoon for the help with ..Profile..

--//And Also 4 The Local msg thing

--//Version 2

--//User's Is Now Also Supported

--//Thanks To [VIP]SilentiQa That Told Me To Add It ;)

--//Bug For Users Fixed



Bot = "robotzel"



--//User enters the hub text

--//[nick] will be replaced with the users name..

--//["Madman"]= "The [nick] has entred", Will show

--// The Madman has entred

table = {



--//Ops



["[-VIP-]VampirE"]= "With ancient spirits cursed though his veins, [nick] has come to suck up everybody's blood",



["[-VIP-]CrAzYLUV"]= "Seful VIP-urilor [nick] va saluta",

["Cory"]= "                                               ========       The cutest girl in town [nick] has entered the hub        ========                                                                         ",

["Ubikk"]= "                                               ========      The hubmaster [nick] has come to open up the Heavens        ========                                                                         ",

                        ["[-VIP-]Foxxy"]= "The VIP [nick] intra si pe la noi si saluta pe toata populatia",

["[-VIP-].belfast"]= "The old and wise prophecy merchant [nick] has arrived at last",

--//Vips

                        ["[-VIP-].antrax"]= "Silence everyone! [nick] enters the hub ... ",
                        ["[-VIP-]ARKY"]= "The Sharpshooter [nick] back around...ya`all better take cover",
["[-VIP-]Blanka"]= "The master of ya`ll has come to lead you...Bow before [nick]",
                        ["[-VIP-]VampirE"]= "With ancient spirits cursed though his veins, [nick] has come to suck up everybody's blood",
                        ["[-VIP-]CrAzYLUV"]= "Seful VIP-urilor [nick] va saluta",
                        ["[-PRO-].Stefan"]= "The Formula 1 pilot [nick] starts his engine and arrives to our hub.",
                        ["KataRynn"]= " The blue-eyes [nick] has entered the hub.",
                        ["[-VIP-]Foxxy"]= "The VIP [nick] intra si pe la noi si saluta pe toata populatia",
                        ["[-PRO-][Xana].[Aramis]"]= "The Trivia legend [nick] has entered the hub.",
                       

--//4 Madhouse

["Madman"]= "The Dragon lord [nick] rided in on his breath of flame",

-- [""]= "[nick]",

}



--//User Disconnect Text

table2 = {



--//Ops

["Ubikk"]= "The hubmaster [nick] has left the Hub to go back to The Heavens",

["Cory"]= "The One And Only [nick] has left the hub",

["x"]= "[nick] disconnects down to flames",

["-=FakeKiller=-"]= "[nick] has gone to the real world, to kill people",

["Dragonmac?"]= "The Network God [nick] has left the hub to go back to the hell",

["[DN]Con"]= "The God of Destruction [nick] has left the hub, to return to heaven",

["[OP]FranticJ1"]= "The GuitarDevil [nick] played on his last song",

["[OP]Bart_simpson"]= "[nick] has been deactivated",

["[OP]Stoffy"]= "[nick] has been kicked",

["KAMBOSS"]= "Now you are all alot wiser, it is time for old [nick] to leave and go spread the shit elsewhere",

--//Vips

["[-VIP-].antrax"]= "[nick] a plecat... am mai scapat de un VIP :)",
                         ["[-VIP-]ARKY"]= "[nick] : I hate everything that dies..that includes you too..i'm out",
                         ["[-VIP-]Foxxy"]= "The VIP [nick] isi ia ramas bun si pleaca unde vede cu ochii :)",
                         ["KataRynn"]= " KataRynn's sweet necromancer is waiting her to die for him, so she's leaving you all to do whatever he wants her to do...",                        
                         ["[VIP]SilentiQa"]= "The One And Only [nick] has left the hub",
                         ["[-PRO-].Stefan"]= "The Formula 1 pilot [nick] starts his engine and leaves our hub.",
                         ["[-PRO-][Xana].[Aramis]"]= "[nick] disconnects down to flames",
                         ["[-VIP-].belfast"]= "The GuitarDevil [nick] played on his last song",

--//4 Madhouse

["Madman"]= "[nick] burns down some fakers on his way out",

-- [""]= "[nick]",

}





--//User's Enter The Hub

function NewUserConnected(curUser)

if table[curUser.sName] then

local msg = gsub(table[curUser.sName], "%[nick%]", curUser.sName)

SendToAll(Bot,msg)

--//If User Send Text... Becuse Users dont have any profile and has to have there own text

else if (curUser.iProfile == -1) then

curUser:SendData(Bot, "Welcome user "..curUser.sName.." Have a Good Time.")

--//If not in table

else

local Profile = GetProfileName(curUser.iProfile)

SendToAll(Bot,"The "..Profile.." "..curUser.sName.." has entered the Hub, Welcome Home.")

end

end

end



--//Users Leaves The Hub

function UserDisconnected(curUser)

if table2[curUser.sName] then

local msg = gsub(table2[curUser.sName], "%[nick%]", curUser.sName)

SendToAll(Bot,msg)

--//If User Send Nothing... Becuse Users dont have any profile

else if (curUser.iProfile == -1) then

curUser:SendData("")

--//If not in table

else

local Profile = GetProfileName(curUser.iProfile)

SendToAll(Bot,"The "..Profile.." "..curUser.sName.." has left the Hub, See you Soon.")

end

end

end



--//Ops Enters The Hub

function OpConnected(curUser)

if table[curUser.sName] then

local msg = gsub(table[curUser.sName], "%[nick%]", curUser.sName)

SendToAll(Bot,msg)

--//If not in table

else

local Profile = GetProfileName(curUser.iProfile)

SendToAll(Bot,"The "..Profile.." "..curUser.sName.." has entered the Hub, Welcome Home.")

end

end



--//Ops Leaves The Hub

function OpDisconnected(curUser)

if table2[curUser.sName] then

local msg = gsub(table2[curUser.sName], "%[nick%]", curUser.sName)

SendToAll(Bot,msg)

--//If not in table2

else

local Profile = GetProfileName(curUser.iProfile)

SendToAll(Bot,"The "..Profile.." "..curUser.sName.." has left the Hub, See you Soon.")

end

end


I just love that script  :D


The 3rd script is this one:


--###############################################--

-- Idle - Users -- By NightLitch 2004-12-23 --

--###############################################--

BotName = "robotzel"

TableCommand = "!idle"

--###############################################--

IdleTimers = {}

--###############################################--

function DataArrival(sUser,sData)

if strsub(sData, 1,1) == "<" then

local _,_,Cmd,Arg = strfind(sData, "%b<>%s+(%S+)%s*(.*)%|")

if Command[Cmd] and sUser.bOperator then

return Command[Cmd](sUser,Arg)

end

IdleTimers[sUser.sName] = clock()

elseif strsub(sData,1,4) == "$To:" then

local s,e,WhoTo,From,Msg = strfind(sData,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)%|")

IdleTimers[From] = clock()

end



end--###############################################--

Command = {}

Command[TableCommand] = function(sUser,sArg)

local _,_,Nickname = strfind(sArg, "(%S+)")

if Nickname == nil then sUser:SendData(BotName, "Syntax: !table ") return 1 end

local tUser = GetItemByName(Nickname)

if tUser == nil then sUser:SendData(BotName, "User "..Nickname.." is not online or wrong username.") return 1 end

if IdleTimers[tUser.sName] then

iTime = clock() - IdleTimers[tUser.sName]

sUser:SendPM(BotName, "User "..tUser.sName.." has been idle for "..TimeUnits(iTime))

else

sUser:SendPM(BotName, "User "..tUser.sName.." hasn't typed anything at all...")

end

return 1

end

--###############################################--

TimeUnits = function(time)

local time = time*1000

local msg = ""

local tO = {

[1] = { 86400000, 0, "days"},

[2] = { 3600000, 0, "hours"},

[3] = { 60000, 0, "minutes"},

[4] = { 1000, 0, "seconds"},

};

for i , v in (tO) do

if time >= tO[i][1] then

repeat

tO[i][2] = tO[i][2] + 1

time = time - tO[i][1]

until time < tO[i][1]

end

end

for i,v in tO do

if tO[i][2] ~= 0 then

msg = msg.." "..tO[i][2].." "..tO[i][3]

end

end

if msg == "" then msg = "0 minutes" end

return msg

end

--###############################################--

--// NightLitch 2004-12-23


I have a few more scripts but i will post them in separate threads  ;)
Thanks everyone  :D
Title:
Post by: Dessamator on 21 May, 2005, 13:06:39
QuoteOriginally posted by Dessamator
for the first script, use nl's lua4 to 5 converter , for the second one
and report any errors after that !
Title:
Post by: Ubikk on 21 May, 2005, 13:15:21
QuoteOriginally posted by Dessamator
QuoteOriginally posted by Dessamator
for the first script, use nl's lua4 to 5 converter , for the second one
and report any errors after that !

Thank you :)

I will report the errors as soon as i can  ;)
Title:
Post by: Madman on 21 May, 2005, 14:31:24
The first script..
It's been converted allready
Click (http://board.univ-angers.fr/thread.php?threadid=3745&boardid=26&sid=7efb0be7a0205d2ca34b4e51527d74d3)

You ppl need to learn to se the search button...
Title:
Post by: jiten on 21 May, 2005, 14:35:14
QuoteOriginally posted by madman
You ppl need to learn to se the search button...
Exactly ;)
Title:
Post by: Ubikk on 21 May, 2005, 15:33:48
well, we people already know the search button... but we didn't found the necessary script ! we apologize for our incompetence  :D
Title:
Post by: Madman on 21 May, 2005, 18:01:59
apologize aseppted ;P
btw... and the magic key world for the search was

Custom Log in Script Made By Madman

:)