Urgent need for>Free Slot Search Bot
 

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

Urgent need for>Free Slot Search Bot

Started by [G-T-E]Gate?, 15 November, 2003, 17:21:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[G-T-E]Gate?

Ive been getting a large request from my users for a bot that will show the users in the hub with Free Slots. Looked thru  the forum and havent found it yet .
Greatfull if some one can give me a link or paste a working script in a Messege.
Thanks

lazyj189

-- SlotsBot for PtokaX DC Hub 0.3.2.6 Test Drive 4 
-- On command +slotssends a search and checks the results for free slots total number of slots 
-- Sends the results in PM from Hub bot 
-- Adaptation by OpiumVolage (01 July 2003based on 
-- retrobotv0.99
-- 
slots module 
-- by tezlo 
-- 2003 
-- Twiddled a bit to have results sent in PM by bolamix 1 July 2003 
-- unused sTarget left for future syntax parsing


botName "your_hub_bot" 

-- library 

function getid(tablename

return 
foreachi(table, function(iditem) if item.sName == %name then return id end end

end 


function putitem(tableitem

if 
not item then return end 

local id 
getid(tableitem.sName

if 
id then table[id] = item 

else tinsert(tableitemid table.

end 
return id 

end 

-- events 

function OnTimer() 

local i while tabSlots[i] do 

local table tabSlots[i

if 
clock() >= table.iClock tmrSlots then 

if table.tItems.== 0 then SendPmToNick(table.sNamebotName"No users with free slots found|"end 

SendPmToNick
(table.sNamebotName"Done|"

tremove(tabSlotsi

if 
tabSlots.== 0 then frmHub:EnableSearchData(0end 

else 1 end 

end 

end 


function slotsOnHub(userargs

local sefreeall strfind(args" (%d+)/(%d+)"..strchar(5)) 

foreachi(tabSlots, function(iditem

if 
not getid(item.tItems, %user.sNamethen 

putitem
(item.tItems, { sName = %user.sNamesValue = %free.."/"..%all }) 

-- if 
item.sTarget and (%user.sName == item.sTargetthen 
-- SendToNick(item.sName"<Slots> user "..%user.sName.." "..%free.."/"..%all.."|"
-- 
item.iClock item.iClock tmrSlots 
-- elseif not item.sTarget and 

if (
tonumber(%free) >= item.iNRthen 

SendPmToNick
(item.sNamebotName" user "..%user.sName.." "..%free.."/"..%all.."|"

end 

end end


end 



function doSlots(usernrnick

user:SendPM(botName"Checking..|"

frmHub:EnableSearchData(1

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

putitem(tabSlots, { sName user.sNameiClock clock(), iNR nrtItems = {n=0} }) 

-- 
putitem(tabSlots, { sName user.sNamesTarget nickiClock clock(), iNR nrtItems = {n=0} }) 

end 

-- init 

tmrSlots 
-- Number of seconds waiting for replys 

tabSlots 
= {n=0

Command "+slots" 


function DataArrival(userdata

if 
strfind(data"%b<>%s+("..Command..").*|"then 

s
enr strfind(data"%b<>%s+"..Command.."%s+([0-9]+)"

if 
s then nr tonumber(nr) else nr 1 end 

doSlots
(usernr) return 

end 

if strfind(data"^%$SR"then slotsOnHub(userdataend 

end 


function Main() 

SetTimer(tmrSlots*1000

StartTimer() 

end

DivX Dominion Hub Owner
3 years running
DivX Dominion Hub

[G-T-E]Gate?

Thanks for ur reply . lazyj189
Have a problem though. Added the script and after checking Syn och restarting script I get the folowing >>
 Syntax Error: attempt to call field `EnableSearchData' (a nil value)

 I gave the bot the name FreeSlotSearch  and even tried using the Main Hub Bot Name which controlls my commands but  still same. Iam running GS1.62  and using PtokaX-0.327.PaueredBai ..  
 I have no other problems  with my scripts and have been running them for over 6months about .
 Thanks in advance

lazyj189

PtokaX-0.327.PaueredBai ????

that doesnt sound like an official ptokax release.  What is it exactly?  this script will work in 3.2.6 TD4, you might want to download the latest "official" ptokax hub.
DivX Dominion Hub Owner
3 years running
DivX Dominion Hub

tezlo

update to testdrive..
man this script also need a rewrite

lazyj189

ya, it needs a little work, but hey, it was right there for the posting
DivX Dominion Hub Owner
3 years running
DivX Dominion Hub

tezlo


SMF spam blocked by CleanTalk