converting some little scripts part1 :)
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

converting some little scripts part1 :)

Started by Ubikk, 21 May, 2005, 12:48:20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ubikk

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

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 !
Ignorance is Bliss.

Ubikk

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  ;)

Madman

The first script..
It's been converted allready
Click

You ppl need to learn to se the search button...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

jiten

QuoteOriginally posted by madman
You ppl need to learn to se the search button...
Exactly ;)

Ubikk

well, we people already know the search button... but we didn't found the necessary script ! we apologize for our incompetence  :D

Madman

apologize aseppted ;P
btw... and the magic key world for the search was

Custom Log in Script Made By Madman

:)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk