Convert to lua5?
 

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

Convert to lua5?

Started by ?[-?Genius?-]?, 30 April, 2005, 18:18:46

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

?[-?Genius?-]?

Hi ppl
I needt o converts this scripts to lua 5
Sory my bad inglish


Script 1
--------------------


botname = "teste"
minutes = 1190   -- podem mudar aqui os minutos
file = "MsgAll2.txt"

function Main()
SetTimer(minutes*60000)
StartTimer()
end

function OnTimer()
MessageToAll()
end

function MessageToAll()
  local handle = openfile(file, "r")
  if (handle ~= nil) then
    local line = read(handle)
    while line do
      SendToAll(botname,line)
      line = read(handle)
    end
    closefile(handle)
  end
end

?[-?Genius?-]?

Script 2
----------------


--Bot Sites feito por Genius
BotName = "DesCrIpT?"
Files = {
      ["!legendas"] = "Ficheiros/legendas.txt",
      ["!codecs"] = "Ficheiros/codecs.txt",
      ["!players"] = "Ficheiros/players.txt",
      ["!capas"] = "Ficheiros/capas.txt",
                ["!cracks"] = "Ficheiros/cracks.txt",
                ["!games"] = "Ficheiros/games.txt",
                ["!lol"] = "Ficheiros/lol.txt",
                ["!gajas"] = "Ficheiros/gajas.txt",
                ["!dance"] = "Ficheiros/dance.txt",
                ["#helpdc1"] = "helpdc/dc1.txt",
                ["#helpdc2"] = "helpdc/dc2.txt",
                ["#helpdc3"] = "helpdc/dc3.txt",
                ["#helpdc4"] = "helpdc/dc4.txt",
                ["#helpdc5"] = "helpdc/dc5.txt",
                ["#helpdc6"] = "helpdc/dc6.txt",
                ["#helpdc7"] = "helpdc/dc7.txt",
                ["#helpdc8"] = "helpdc/dc8.txt",
                ["#helpdc9"] = "helpdc/dc9.txt",
                ["#helpdc10"] = "helpdc/dc10.txt",
      ["#helpdc11"] = "helpdc/dc11.txt",
      ["#helpdc12"] = "helpdc/dc12.txt",
      ["#helpdc13"] = "helpdc/dc13.txt",
      ["#helpdc14"] = "helpdc/dc14.txt",
      ["#helpdc15"] = "helpdc/dc15.txt",
      ["#helpdc16"] = "helpdc/dc16.txt",
      ["#helpdc17"] = "helpdc/dc17.txt",
      ["#helpdc18"] = "helpdc/dc18.txt",
      ["#helpdc19"] = "helpdc/dc19.txt",
      ["#helpdc20"] = "helpdc/dc20.txt",
      ["#helpdc21"] = "helpdc/dc21.txt",
   }
function Main()
end
function DataArrival(user, data)
   if( strsub(data, 1, 1) == "<" ) then
      s,e,msg = strfind(data, "%b<> ([ -z]*)")
      for key, value in Files do
         if( strfind( strlower(msg), key) ) then
            txtToShow, x = gsub(value, "%b[]", user.sName)
            SendToAll( data )
            Show(user, TheFile)
            return 1
         end
      end
   end
end
function Show(user, TheFile)
   readfrom(txtToShow, "r")
   local message = ""
   while 1 do
      local line = read()
      if line == nil then break
      else
         message = message..line.."\r\n"
      end
   end
   user:SendData(BotName, message)
   readfrom()
end

?[-?Genius?-]?

#2
Script 3
-------------------

Its a pm script...Removed By Genius

Sory evryone

?[-?Genius?-]?

Script 4
-----------------

function zeitAnzeige()

local sHour = date("%H")

local sMin = date("%M")

UhrZeit=("\t\t\t\t- = [ " ..sHour.. ":" ..sMin.. " ] = - ")

if sMin=="00" then

SendToAll("(??????)?M?3?T?g??", UhrZeit)

StopTimer()

local sSec = date("%S")

SetTimer(60*60*1000-sSec+5*1000)

StartTimer()

end

end



function OnTimer()

zeitAnzeige()

end



function Main()

SetTimer(57000)

StartTimer()

end

?[-?Genius?-]?

Script 5
-----------------

--changed 2 testdrive4, really buggy.

BotName = "M?3?T?g??"

tabSlots = {n=0}

tmrSlots = 55

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 == "+slots" or cmd == "!slots") then

s,e,cmd,nr = strfind(data,"%b<>%s+(%S+)%s*(.*)")

frmHub:EnableSearchData(1) --opening search

user:SendData(" M?3?T?g?? ", "Checking...")

-- new user to keep track of, also save the time we started

tinsert(tabSlots, { sName = user.sName, iClock = clock(), tItems = {} })

SendToAll("$Search Hub:"..BotName.." T?F?0?1?.|")

end

end

if (strsub(data, 1, 3) == "$SR") then

-- incoming search results.. lets extract info about free slots

local s, e, free, all = strfind(data, " (%d+)/(%d+)"..strchar(5))

local i = 1 while tabSlots do

local table = tabSlots

if not table.tItems[user.sName] then

-- first results from user.sName

table.tItems[user.sName] = free.."/"..all

if (nr == "" and free ~= "0") then

SendToNick(table.sName, "< M?3?T?g?? >  ?  O user  ?  "..user.sName.."  ?  "..free.."/"..all.."  ? ")

elseif (nr ~= "" and all >= nr) then

SendToNick(table.sName, "< M?3?T?g?? > user ~ "..user.sName.." ~ "..all)

end

end

if clock() >= table.iClock + tmrSlots then

-- listing timeout

if getn(table.tItems) == 0 then

SendToNick(table.sName, "< M?3?T?g?? > No users with free slots found", pm)

elseif getn(table.tItems) >= nr then

SendToNick(table.sName, "< M?3?T?g?? > No users with that kind of slots found", pm)

end

SendToNick(table.sName, "< M?3?T?g?? > Done") tremove(tabSlots, i)

frmHub:EnableSearchData(0) -- closing search

else

i = i + 1

end

end

end

end

?[-?Genius?-]?

Script 6
-------------------

-- Script For Bot Description

gb = 1024 * 1024 * 1024
bot_name = "(??????)?M?3?T?g??"
bot_email = "HubMp3World@hotmail.com"
bot_speed = "Bot"
bot_descr = "? [??] k s okupa do Hu? em geral ?"
bot_share_size = 1100156237684 * 1024 * gb

bot_name2 = "(??????)?M?3?i??"
bot_email2 = "HubMp3World@hotmail.com"
bot_speed2 = "Bot"
bot_descr2 = "? [??] k filtra os IPs permitidos no Hu? ? "
bot_share_size = 1100156237684 * 1024 * gb  

bot_name3 = "(??????)?M?3?Ch?t?"
bot_email3 = "HubMp3World@hotmail.com"
bot_speed3 = "Bot"
bot_descr3 = "? [??] Chat dos Operadores ?"
bot_share_size = 1100156237684 * 1024 * gb  

bot_name4 = "(??????)?M?3????"
bot_email4 = "HubMp3World@hotmail.com"
bot_speed4 = "Bot"
bot_descr4 = "? [??] k verifika kem faz PU? ? "
bot_share_size = 1100156237684 * 1024 * gb



function Main()
   frmHub:RegBot( bot_name )
   my_info_string = "$MyINFO $ALL "..bot_name.." "..bot_descr.."$ $"..bot_speed..strchar( 1 ).."$"..bot_email..
          "$"..bot_share_size.."$"

        frmHub:RegBot( bot_name2 )
   my_info_string2 = "$MyINFO $ALL "..bot_name2.." "..bot_descr2.."$ $"..bot_speed2..strchar( 1 ).."$"..bot_email2..
          "$"..bot_share_size.."$"

   frmHub:RegBot( bot_name3 )
   my_info_string3 = "$MyINFO $ALL "..bot_name3.." "..bot_descr3.."$ $"..bot_speed3..strchar( 1 ).."$"..bot_email3..
          "$"..bot_share_size.."$"

   frmHub:RegBot( bot_name4 )
   my_info_string4 = "$MyINFO $ALL "..bot_name4.." "..bot_descr4.."$ $"..bot_speed4..strchar( 1 ).."$"..bot_email4..
          "$"..bot_share_size.."$"

end

function OpConnected( user )
      user:SendData( my_info_string )
      user:SendData( my_info_string2 )
      user:SendData( my_info_string3 )
      user:SendData( my_info_string4 )
end
function NewUserConnected( user )
      user:SendData( my_info_string )
      user:SendData( my_info_string2 )
      user:SendData( my_info_string3 )
      user:SendData( my_info_string4 )
end

?[-?Genius?-]?

Script 7
--------------


--------------------------------------------------
--                  --
-- This bot is designed to fix the       --
-- "*** Your nick is taken" bug when a user is   --
-- disconnected from the hub.         --
--                   --
-- For more details go to:         --
-- http://students.dwc.edu/cbarber/nickbug.html--
--                  --
-- By RabidWombat & }Cyber-God{            --
--------------------------------------------------

BotName = "(??????)?M?3?T?g??";
BotVersion = "v.1";
BotAuthor = "Genius";

NickMessage = "O teu nick j? est? em uso, por favor eskolhe outro!"
Title = BotName.." "..BotVersion.." by: "..BotAuthor;
Message = "S foste diskonektado do HUB, espera 1 minuto k ? p o teu ghost-user perder a liga??o, e j? poder?s rekonektar.";

TriesArray = {};
TimeToWait = 20; -- in seconds
MaxTries = 3;

function Main()
   frmHub:RegBot(BotName);
   frmHub:EnableFullData(1);
   frmHub:EnableSearchData(0);
   SetTimer(1000);
   StartTimer();
end

function OnTimer()
-- This is designed so old entries will be removed from the table

   for UserName,TryTable in TriesArray do

      if(TryTable[0] == nil or TryTable[1] == nil) then
         TriesArray[UserName] = nil;   -- set entry to be removed
         return;
      end

      TryTable[1] = TryTable[1] - 1;      -- decrement time count
      
      if(TryTable[1] <= 0) then       -- less than just in case
         TryTable[1] = TimeToWait;   -- reset time count for next decrement
         TryTable[0] = TryTable[0] - 1;         -- decrement try count

         if(TryTable[0] <= 0) then       -- less than just in case
            TriesArray[UserName] = nil;   -- set entry to be removed
         end
      end
   end
end

function DataArrival(curUser, sData)
   if curUser.sName == "" and strsub(sData, 1, 13) == "$ValidateNick" then
      local s, e, name = strfind(sData, "$ValidateNick (%S+)");
      name = strsub(name, 1, strlen(name) - 1);

      if(GetItemByName(name)) then
         if(TriesArray[name] and TriesArray[name][0]) then
            TriesArray[name][0] = TriesArray[name][0] + 1;   -- increment tries
            if(TriesArray[name][0] > MaxTries) then
               TriesArray[name][1] = TimeToWait;   -- reset time count
               return;               -- do not send message
            end
         else
            TriesArray[name] = {1, TimeToWait};
         end

         SendToNick(name, "testing this connection|");   -- Check for ghost
         curUser:SendData("*** "..NickMessage);      -- Do hubs job
         curUser:SendData("*** "..Title);      -- Inform new user
         curUser:SendData("*** "..Message);

         -- Disconnect user before $ValidateDenide is sent
         -- Some clients do not reconnect automatically correctly when this message is sent
         curUser:Disconnect();

         return 1;
      end
   end
end

function OnNewUserConnected(curUser)   -- Remove entry if user connects
   if(TriesArray[curUser.sName]) then
      TriesArray[curUser.sName] = nil;
   end
end

function OnNewOpConnected(curUser)   -- Remove entry if op connects
   if(TriesArray[curUser.sName]) then
      TriesArray[curUser.sName] = nil;
   end
end

?[-?Genius?-]?

Sorry about the amount of scripts
I have time  :]

jiten

Have you searched the forum before?
If i'm not wrong, I've seen some of those scripts already converted to Lua 5.

Cheers

Typhoon

#9
QuoteOriginally posted by ?[-?Genius?-]?
Script 3
-------------------

-- vim:ts=4:sw=4:noet
--
-- spy snooper bot for PtokaX (tested on 0.3.2.3 Test2B)
-- by Sedulus 20030201, no rights reserved

 That won't happend inhere m8.. PM stands for PRIVATE MESSAGE ..  and most users that post such scripts will be hearing for it .. so prepare yourself for the mob !


Typhoon?

*edit* Script 7 is not needed since that "bug" is fixed in the lua 5 version ...



Madman

Script 3 should not, and probarly wont be converted.
beacuse pmspys is not liked here...

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

Dessamator

QuoteOriginally posted by madman
Script 3 should not, and probarly wont be converted.
beacuse pmspys is not liked here...

See this thread

lets just hope he/she understands, ;)
Ignorance is Bliss.

?[-?Genius?-]?

#12
Hi

Sory abaut script 3. I remove

jiten

QuoteOriginally posted by Dessamator
QuoteOriginally posted by madman
Script 3 should not, and probarly wont be converted.
beacuse pmspys is not liked here...

See this thread

lets just hope he/she understands, ;)
Yups.

Madman

#14
Script 1, first script in thread...

Script 2
--Bot Sites feito por Genius
-- Converted to lua 5 by Madman

BotName = "DesCrIpT™"

Files = {
["!legendas"] = "Ficheiros/legendas.txt",
["!codecs"] = "Ficheiros/codecs.txt",
["!players"] = "Ficheiros/players.txt",
["!capas"] = "Ficheiros/capas.txt",
["!cracks"] = "Ficheiros/cracks.txt",
["!games"] = "Ficheiros/games.txt",
["!lol"] = "Ficheiros/lol.txt",
["!gajas"] = "Ficheiros/gajas.txt",
["!dance"] = "Ficheiros/dance.txt",
["#helpdc1"] = "helpdc/dc1.txt",
["#helpdc2"] = "helpdc/dc2.txt",
["#helpdc3"] = "helpdc/dc3.txt",
["#helpdc4"] = "helpdc/dc4.txt",
["#helpdc5"] = "helpdc/dc5.txt",
["#helpdc6"] = "helpdc/dc6.txt",
["#helpdc7"] = "helpdc/dc7.txt",
["#helpdc8"] = "helpdc/dc8.txt",
["#helpdc9"] = "helpdc/dc9.txt",
["#helpdc10"] = "helpdc/dc10.txt",
["#helpdc11"] = "helpdc/dc11.txt",
["#helpdc12"] = "helpdc/dc12.txt",
["#helpdc13"] = "helpdc/dc13.txt",
["#helpdc14"] = "helpdc/dc14.txt",
["#helpdc15"] = "helpdc/dc15.txt",
["#helpdc16"] = "helpdc/dc16.txt",
["#helpdc17"] = "helpdc/dc17.txt",
["#helpdc18"] = "helpdc/dc18.txt",
["#helpdc19"] = "helpdc/dc19.txt",
["#helpdc20"] = "helpdc/dc20.txt",
["#helpdc21"] = "helpdc/dc21.txt",
}

function ChatArrival(user, data)
	s,e,msg = string.find(data, "%b<> ([ -z]*)")
	for key, value in Files do
		if( string.find( string.lower(msg), key) ) then
			txtToShow, x = string.gsub(value, "%b[]", user.sName)
			--SendToAll( data )
			Show(user, TheFile)
			return 1
		end
	end
end

function Show(user, TheFile)
	local file = io.input(txtToShow)
	local line = io.read("*a")
		msg = msg.."\r\n"..line.."\r\n"
	user:SendData(BotName, msg)
	file:read()
	file:close()
end

Script 4 find these lines and change them to this
local sHour = date("%H") -> local sHour = os.date("%H")
local sMin = date("%M") -> local sMin = os.date("%M")
local sSec = date("%S") -> local sSec = os.date("%S")

as you can see i only added os. before the date

Sript 5

Script 6
-- Script For Bot Description
-- Converted to lua 5 by Madman
-- Optimized some...

Bot = {
	["Name"] = "(•???†•)M?3?T?g?™",
	["Email"] = "HubMp3World@hotmail.com",
	["Descr"] = "? [??] k s okupa do Hu? em geral ?",
	["Speed"] = "Bot",
	["Share"] = 1024 * 1024 * 1024,
}
Bot2 = {
	["Name"] = "(•???†•)M?3?i?™",
	["Email"] = "HubMp3World@hotmail.com",
	["Descr"] = "? [??] k filtra os IPs permitidos no Hu? ? ",
	["Speed"] = "Bot",
	["Share"] = 1024 * 1024 * 1024,
}
Bot3 = {
	["Name"] = "(•???†•)M?3?Ch?t™",
	["Email"] = "HubMp3World@hotmail.com",
	["Descr"] = "? [??] Chat dos Operadores ?",
	["Speed"] = "Bot",
	["Share"] = 1024 * 1024 * 1024,
}
Bot4 = {
	["Name"] = "(•???†•)M?3????",
	["Email"] = "HubMp3World@hotmail.com",
	["Descr"] = "? [??] k verifika kem faz PU? ? ",
	["Speed"] = "Bot",
	["Share"] = 1024 * 1024 * 1024,
}

function Main()
frmHub:RegBot(Bot.Name)
MyInfoString = "$MyINFO $ALL "..Bot.Name.." "..Bot.Descr.."$ $"..Bot.Speed..string.char(1).."$"..Bot.Email.."$"..Bot.Share.."$"
SendToAll(MyInfoString)

frmHub:RegBot(Bot2.Name)
MyInfoString2 = "$MyINFO $ALL "..Bot2.Name.." "..Bot2.Descr.."$ $"..Bot2.Speed..string.char(1).."$"..Bot2.Email.."$"..Bot2.Share.."$"
SendToAll(MyInfoString2)

frmHub:RegBot(Bot3.Name)
MyInfoString3 = "$MyINFO $ALL "..Bot3.Name.." "..Bot3.Descr.."$ $"..Bot3.Speed..string.char(1).."$"..Bot3.Email.."$"..Bot3.Share.."$"
SendToAll(MyInfoString3)

frmHub:RegBot(Bot4.Name)
MyInfoString4 = "$MyINFO $ALL "..Bot4.Name.." "..Bot4.Descr.."$ $"..Bot4.Speed..string.char(1).."$"..Bot4.Email.."$"..Bot4.Share.."$"
SendToAll(MyInfoString4)
end

function NewUserConnected(user)
user:SendData(MyInfoString)
user:SendData(MyInfoString2)
user:SendData(MyInfoString3)
user:SendData(MyInfoString4)
end

OpConnected = NewUserConnected

QuoteOriginally posted by Typhoon™
Script 7 is not needed since that "bug" is fixed in the lua 5 version ...

The board fu*ked up the bot names... so u need to change that....
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

?[-?Genius?-]?

Tank you :)
i go test.

This forum have the best lua suport :)

SMF spam blocked by CleanTalk