ScreenCleaner - that good old cls command
 

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

ScreenCleaner - that good old cls command

Started by yepyepyep4711, 28 March, 2004, 03:10:21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yepyepyep4711

Hi guys,

for what it's worth, my first script in lua ever. Do you remember that "cls" command from the old days? Well here it is. Imagine you typed a password in the main by mistake, someone posted something you find offensive or don't want the wolrd at large to read for whichever reason, just type !cls and the main chat will be wiped clean (well people can always scroll back, but that'll do the trick for most of them)

Enjoy!

--ScreenCleaner.lua 1.0 by yepyepyep4711
--!cls will wipe the main chat clean
--the command will be added to the rightclick menu of the OPs (optional)

botname = "ScreenCleaner"
rightclick = 1 -- if anything else than 1 rightclick menu won't appear
function DataArrival (curUser, sData)
command=strsub(sData,1,strlen(sData)-1)
s,e,cmd = strfind(command,"%b<>%s+(%S+)")
	if curUser.bOperator then
		if cmd=="!cls" then
				SendToAll(botname, "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n")
		end
	end
end

function OpConnected(curUser)
	if rightclick == 1 then
		curUser:SendData("$UserCommand 255 7") 
		curUser:SendData("$UserCommand 0 3") 
		curUser:SendData("$UserCommand 1 2 Clear Screen$<%[mynick]> !cls|") 
	end
end

PS: I'm sure it's no "elegant code", but it works ;p

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

didnt seem to work for me..

i cant get the  user menu working. but that might be my client.


the !cls  works with this and wipes the whole main chat

--ScreenCleaner.lua 1.0 by yepyepyep4711
--!cls will wipe the main chat clean
--the command will be added to the rightclick menu of the OPs (optional)

botname = "ScreenCleaner"
rightclick = 1 -- if anything else than 1 rightclick menu won't appear
function DataArrival (curUser, sData)
command=strsub(sData,1,strlen(sData)-1)
s,e,cmd = strfind(command,"%b<>%s+(%S+)")
	if curUser.bOperator then
		if cmd=="!cls" then
		temp = "\r\n"
		   for i=1,10000,1 do
			temp = temp.."\r\n"
		   end 
			SendToAll(botname, temp)
		end
	end
end

function OpConnected(curUser)
	if rightclick == 1 then
		curUser:SendData("$UserCommand 255 7") 
		curUser:SendData("$UserCommand 0 3") 
		curUser:SendData("$UserCommand 1 2 Clear Screen$<%[mynick]> !cls|") 
	end
end

tezlo

seems a bit brutal when you can just type /clear

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

the  /clear  only wipes it from your client .  not everyone elses...

yepyepyep4711

ok, the version from Hawk is much better. Mine has the inconvenient of that huge line of \r\n that *must* be kept together otherwise the script won't work. On the other hand, 10000 will slow the excution of the script and won't flush the main completely anyway. I've tried 50000, it still doesn't flush it entirely, but took way too much cpu time (and don't forget the bandwidth for big hubs). So I'd rather advise toward 200. That way the script stays responsive, which I find good, because most of the time when you want to hide something you want to do it quick ;)

So for all of you that just want a quick grab of the last version, here goes:
--ScreenCleaner.lua 1.1 by yepyepyep4711 and Hawk
--!cls will wipe the main chat clean
--the command will be added to the rightclick menu of the OPs (optional)

botname = "ScreenCleaner"
rightclick = 1 -- if anything else than 1 rightclick menu won't appear
function DataArrival (curUser, sData)
command=strsub(sData,1,strlen(sData)-1)
s,e,cmd = strfind(command,"%b<>%s+(%S+)")
	if curUser.bOperator then
		if cmd=="!cls" then
			temp = "\r\n"
			for i=1,200,1 do
				temp = temp.."\r\n"
			end 
			SendToAll(botname, temp)
		end
	end
end

function OpConnected(curUser)
	if rightclick == 1 then
		curUser:SendData("$UserCommand 255 7") 
		curUser:SendData("$UserCommand 0 3") 
		curUser:SendData("$UserCommand 1 2 Clear Screen$<%[mynick]> !cls|") 
	end
end

Tarot

lol it clear the hole main hihihihihihiihihih
Gothic Metal City
       

photoshop and 3D



Corayzon

Quote
temp = "\r\n"
	for i=1,10000,1 do
		temp = temp.."\r\n"
	end 

	SendToAll(botname, temp)

this is a bit silly...and what is the real need...

4*10000 bytes to each user seems a bit to much for something that just cleans the screen :/

wouldnt a smart way to go about this be something like... SendDataToAll("/clear|") :SSS

SMF spam blocked by CleanTalk