Convert to LUA 5
 

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 LUA 5

Started by ?[-?Genius?-]?, 13 April, 2005, 23:33:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

?[-?Genius?-]?

Hi

i need this script to Lua 5 :)
Sory my bad inglish



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

??????Hawk??????

QuoteConvert to LUA 5


LEARN TO USE THE FORUM  



It took me longer to type this reply than it did to find an already converted script...

SEARCH   SEARCH   SEARCH   ....  

and if that Fails  ...   Try LOOKING FOR IT...

??????Hawk??????

jiten

Check this thread.

Best regards,

jiten

?[-?Genius?-]?

hi

sory but i?m loking for script and is not =
my script send info in main chat for user, and another send in pm. Sory my inglish

jiten

QuoteOriginally posted by ?[-?Genius?-]?
hi

sory but i?m loking for script and is not =
my script send info in main chat for user, and another send in pm. Sory my inglish
Just change in the script "SendPM" to "SendData" and the messages will appear on main instead of in PM.

Cheers

?[-?Genius?-]?

hi

i gangue the script but don?t work :(

Syntax ...\Ambiente de trabalho\Ptolax 17.03\scripts\slots.lua:43: attempt to index global `user' (a nil value)

In main chat apearence this

[13:22] <(??????)?M?3?T?g??>  ? A procurar... ?

and stop :(

Dessamator

#6
--By Tezlo

slots = {}
nslots = 0
timeout = 360 -- cache life in seconds
message = "%s has %d slots free [as of %d minutes ago]"
botname = frmHub:GetHubBotName()

function Main()
	SendToAll("$Search Hub:"..botname.." T?F?0?1?.|")
end

function SRArrival(user, data)
	local s, e, free, all = string.find(data, " (%d+)/(%d+)\005")
	if free ~= "0" then
		if not slots[user.sName] then
			nslots = nslots + 1
		end
		slots[user.sName] = { tonumber(free), os.clock() }
	end
end

function ChatArrival(user, data)
	local s, e, cmd = string.find(data,"^%b<> [!+](%a+)")
	if cmd == "slots" then
		local now = os.clock()
		for k, v in pairs(slots) do
			if now > v[2] + timeout then
				nslots = nslots - 1
				slots[k] = nil
			else
				user:SendData(botname, string.format(message, k, v[1], math.floor((now-v[2])/60)))
			end
		end
		user:SendData(botname, nslots.." items")
		return 1
	end
end        
Done!!,

Try that
Ignorance is Bliss.

?[-?Genius?-]?

Tankx :)
Its working

SMF spam blocked by CleanTalk