Clear OnTimer
 

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

Clear OnTimer

Started by Madman, 23 November, 2004, 17:59:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madman

Hi, i want to clear
NNicks = {}
ontimer...
But only if is one or more username in it...

This is beacuse i have more things to clear
and i only want to clear them if they have users in them..

--Crazy Animals 2.0 Script Powered by Demone.Astaroth
--//Modded By Madman
--//Called NuttyNicks instead
--//Added Timer
--//More Nicks Added

--Script temporarily gives to users a strange nick :)
--2 options (fixed and random nicks, always for the current session); stopping command clean the memory

--Commands:
--  !NNick fix -- Let's start the fixed NNickals' nick party!
--  !NNick on -- Let's start the random NNickals' nick party!
--  !NNick off -- Stop the parties

Bot = "NuttYNicks"
HubBot = frmHub:GetHubBotName() --//Gets The HubBots Name
HubName = frmHub:GetHubName() --//Gets The HubName
OpChat = frmHub:GetOpChatName() --//Gets The OpChats Name

NNick = 0

NuttyNicks = { 
"Two-rostrum Platypus",
"Marmot drowning in the chocolate",
"Cold snowy bison",
"Antelope with feet in the cement",
"Hot Pigskin",
"Kiwi's beak",
"Twisting hamster",
"Demented anteater",
"Caffettiera che sta per esplodere",
"Emasculate crocodile",
"Thermo-tapir",
"Gnu beaten by demented fridges",
"Sucker shark with plastic teeth",
"Canary with sticky wings",
"Disgusting insect",
"Crane creeping without legs",
"Blind guide dog",
"Calamary with rostrum",
"Mad koala",
"Flamingo in the toilet",
"Salmon still talking on the plate",
"Door mat with noses",
"Beaks soup",
"Multipurpose octopus",
HubBot,
OpChat,
HubName,
"Madman Is The Devil",
"Werdis Nickus",
Bot,
}

NNicks = {}

NNTime = 1000 * 60 * 10

function Main()
frmHub:RegBot(Bot)
frmHub:GetHubBotName() --//Returns The Name Of The HubBot
frmHub:GetOpChatName() --//Returns The Name Of The OpChat-Bot
frmHub:GetHubName() --//Returns The HubName
end

function OnTimer()
	NNicks=nil
	NNick=0
	StopTimer()
	SendToAll(Bot, "Nutty Nicks Cleared")
end

function DataArrival(curUser, data) 
s,e,cmd= strfind(data,"%b<>%s+(%S+)")
	if NNick==1 then
		if NNicks[curUser.sName]==nil then
			NNicks[curUser.sName]=NuttyNicks[random(1, getn(NuttyNicks))]
		end
	end
	if curUser.bOperator ~= nil then
	s,e,cmd,status= strfind(data,"%b<>%s(.+)%s(.+)")
		if (cmd == "!nn") then
			if strfind(status, "fix") then
				StopTimer()
				SetTimer(NNTime)
				StartTimer() 
				SendToAll(Bot, curUser.sName.. " made all nicks go weird")
				NNick=1
			elseif strfind(status, "off") then
				SendToAll(Bot, curUser.sName.." made all nicks normal")
				NNicks[curUser.sName]=nil
				NNick=0
			elseif strfind(status, "on") then
				StopTimer()
				SetTimer(NNTime)
				StartTimer() 
				SendToAll(Bot, curUser.sName.. " made all nicks go weird")
				NNick=2
			end
		return 1
		end
	end
	if NNick==1 then
		if not strfind(data, "$.+") then
		s,e,mes = strfind(data, "%b<> (.*)")
			if NNicks[curUser.sName]~=nil then
				SendToAll(NNicks[curUser.sName], mes)
			return 1
			end
		end
	elseif NNick==2 then
		if not strfind(data, "$.+") then
		s,e,mes = strfind(data, "%b<> (.*)")
		Nutty=NuttyNicks[random(1, getn(NuttyNicks))]
		SendToAll(Nutty, mes)
		return 1
		end
	end
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

enema

What does this bot should do anyway? (dont have time to run trough)

Madman

#2
It changes the names on the users writing in main

[18:47:32] Madman made all nicks go weird
[18:47:51] This is with the
[18:47:58] command !nn fix
[18:48:06] Madman made all nicks go weird
[18:48:11] and this is
[18:48:24] with the
[18:48:35] command !nn on

It's me writing all the posts ;p

*edit*
Another Question
Is it posibole to have 2 timers?
like
StartNNTimer() and StartDrunkTimer()
and ofcourse set and stop to them...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Herodes

just use

function OnTimer()
NNicks = {}
end

it doesnt make any difference if there are any nicks in there or not ...


and as far as the multitimers are concerned check how much help you can find when searching the forum on "multi timer" ;)

Madman

#4
Thanks i'll have a look at it tomorrow... to late for it now..

*edit*
So i looked at it anyway... ;p

I know it will clean the nicks..

But i want some kind of option...
for it to clean only if it contains nick or something... :/

Since i want to use 2 timers
SetTimer(DrunkTime)
SetTimer(NuttyNicks)
They are 2 diffrent commands on the timers...

The Drunk thing make the user not able to type and then the script types something from the table when the user tries to type....

The NuttyNick changes the nick on users writing in main..

The thing is that i want Drunk To last 5 min before it clened by the timer...
But the NuttyNick, should last 10 min instead...

The NuttyNick is only a part of my script....
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Herodes

If you only have two tables to empty with one of them having the half interval of the other then y not make it like this ... ?
sec = 1000
min = 60*sec

time1 = 5*min
tcount = 0 

function Main()
	SetTimer(sec)
	StartTimer()
end

function OnTimer()
	if tcount == time1 then
		table1 = {}
		tcount = 0
	elseif tcoun == (time1/2) then
		table2 = {}
	end
end

Madman

Thanks, i'll give it a try.. =)
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