PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Intel on 16 March, 2004, 23:32:14

Title: Garbage ?
Post by: Intel on 16 March, 2004, 23:32:14
Hey Guys,
I just need to clear a few things. in Ptokax Hub I see Under Advance Options... a info box which tells how much memory I use now and how much is in the garbage.. What Shall I use that Garbage info too ? And how can i reset that info to 00. I mean How can i clear the garbage.

Advance Thanks
Title:
Post by: NightLitch on 16 March, 2004, 23:36:41
try something like this:

function Clear(Table)
Table = nil
Table = {}
collectgarbage()
flush()
end
Title:
Post by: Intel on 16 March, 2004, 23:38:06
that was a quick answer...thanks buddy :O
Title:
Post by: Intel on 16 March, 2004, 23:38:54
but how to clear it ?
Title:
Post by: NightLitch on 16 March, 2004, 23:43:37
k simple,

make a command or timer and when triggerd garbage is emty.

ex:


if cmd=="!cleanmem" then
    collectgarbage()
    flush()
    curUser:SendData(Bot,"Garbage Memory cleaned")
end

or

Nick = "YourNick"

function OnTimer()
    collectgarbage()
    flush()
    SendToNick(Nick,Bot,"Garbage Memory cleaned")
end

only do pieces becouse know you can script a bit.

this is some solusions from me.

/NL
Title:
Post by: Intel on 16 March, 2004, 23:48:18
I am really empty of ideas,  : (
Title:
Post by: [NL]trucker on 16 March, 2004, 23:53:36
hay nightlitch

i could use something like that aswel and next question is how to remove bots from that part of pkotax?

cause it happens that after i have removed a bot from scriptdir it was removed from scripteditor but not from the advanced options tab thus the bot is still showing using memory.

or would this bot take care of that also cause the bot is garbage?
Title:
Post by: NightLitch on 16 March, 2004, 23:58:48
QuoteOriginally posted by [NL]trucker
hay nightlitch

i could use something like that aswel and next question is how to remove bots from that part of pkotax?

cause it happens that after i have removed a bot from scriptdir it was removed from scripteditor but not from the advanced options tab thus the bot is still showing using memory.

or would this bot take care of that also cause the bot is garbage?

don't know. haven't played with this so much. or it is not to too much to play with but.. :-p
Title:
Post by: NightLitch on 16 March, 2004, 23:59:28
here is a simple code:

function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
-- parse the command
s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*")
cmd=strsub(cmd,1,strlen(cmd)-1)
if (cmd=="!cleanmem") then
collectgarbage()
flush()
user:SendData("MemClean","Garbage Memory cleaned")
end
end
end

/NL
Title:
Post by: NotRabidWombat on 17 March, 2004, 00:03:40
The value you are looking at is Garbage Collector Threshold. When the memory used by the script reaches this value the garbage collector is kicked off automatically. That's the whole purpose of the garbage collector. Remove the programmer from memory management.

-NotRabidWombat
Title:
Post by: [NL]trucker on 17 March, 2004, 12:44:27
NotRabidWombat

lol

i did remove the script out of the scriptdir but it still shows in there.
and have restarted scripts several times just wanted to know if it is possiblle to remove it with some kind of script or do i need to restart hub to get rid of it.

the last option i hate as i,m running now with over 1130 users and havent restarted since :

[12:43:42] *** 9 days, 3 hrs. 40 min. and 44 sec.


so i would hate it since my last record is at 12 days ...lol
Title:
Post by: plop on 17 March, 2004, 15:40:46
QuoteOriginally posted by [NL]trucker
NotRabidWombat

lol

i did remove the script out of the scriptdir but it still shows in there.
and have restarted scripts several times just wanted to know if it is possiblle to remove it with some kind of script or do i need to restart hub to get rid of it.

the last option i hate as i,m running now with over 1130 users and havent restarted since :

[12:43:42] *** 9 days, 3 hrs. 40 min. and 44 sec.


so i would hate it since my last record is at 12 days ...lol
this tiny script removes bot's from the userlist.
Bot = "name_of_the_bot_2_be_removed"

funtion Main()
   frmHub:UnregBot(Bot)
end
but the problem you see is actualy a bug in the 0.3.3.0 beta.
the window doesn't get refreshed correct on removal of a script (i've seen 2x the same script there).

plop