converting some little scripts part2 :)
 

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

converting some little scripts part2 :)

Started by Ubikk, 21 May, 2005, 12:56:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ubikk

Hello again :)

These are the remaining scripts that i need to convert to lua 5  8)


Firste one:


QuoteBotName = "robotzel"
SeenTrigger = "!seen"


minLen = 2

maxLen = 50

seenArray={}



function Main()

frmHub:RegBot(BotName)

end



function NewUserConnected(curUser)

local boolDisc = 0

if strlen(curUser.sName) < minLen then

curUser:SendPM(BotName, "Your nick is to short, a minimum of "..minLen.." chars is required!")

curUser:SendPM(BotName, "Disconnecting...")

curUser:Disconnect()

boolDisc = 1

elseif strlen(curUser.sName) > maxLen then

curUser:SendPM(BotName, "Your nick is to long, a maximum of "..maxLen.." chars is required!")

curUser:SendPM(BotName, "Disconnecting...")

curUser:Disconnect()

boolDisc = 1

elseif ( strfind (curUser.sName, " ", 1, 1) ) then

curUser:SendPM(BotName, " fara spatii libere pt nickname uri ;)")

curUser:SendPM(BotName, "Disconnecting...")

curUser:Disconnect()

boolDisc = 1

end

if (boolDisc == 0) then

seenArray[strlower(curUser.sName)]=date(curUser.sName.." s-a conectat la ora %d/%m/%Y %T si inca mai este printre noi :)")

end

end



function OpConnected(curUser)

seenArray[strlower(curUser.sName)]=date(curUser.sName.." a intrat pe hub la ora %d/%m/%Y %T si inca mai pierde vremea pe aici :)")

end



function OpDisconnected(curUser)

seenArray[strlower(curUser.sName)]=date(curUser.sName.." ne-a parasit la ora %d/%m/%Y %T ... imi pare atat de rau :_( ")

end



function UserDisconnected(curUser)

seenArray[strlower(curUser.sName)]=date(curUser.sName.." a plecat la ora %d/%m/%Y %T ... deja ti-e dor? :)")

end



function DataArrival(curUser, data)

seenArray[strlower(curUser.sName)]=date(curUser.sName.." a fost vazut(a) ultima oara la %d/%m/%Y %T frecand menta :P")

if( strsub(data, 1, 1) == "<" ) then

data=strsub(data,1,strlen(data)-1)

_,_,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )

if (cmd == SeenTrigger) then

if (strlower(arg) == strlower(curUser.sName)) then

SendToAll(BotName, " iar te-ai pierdut, "..arg.." ? :D" )

elseif (seenArray[strlower(arg)] ~= nil) then

SendToAll(BotName, "User: "..seenArray[strlower(arg)] )

else

SendToAll(BotName, " nush, eu nu l-am zarit inca pe "..arg.." ... du-te si intreaba pe altcineva :)" )

end

end

end

end


That's a very useful script  :rolleyes:

And the last one:


Quote-- TrickerBot2.lua, created by Ptaczek Dec-24, 2002
-- Just see how to implement the NMDC TriggerBot in LUA :)   
-- changes
-- Feb-24, 2003, v2.0 Modification for DataArrival return value.
-- Tiny changes by VidFamne with lot of help by Piglja
-- VidFamne added Pigljas time-function, and some more trigs
-- A bug-fix by VidFamne, hopefully. And added some more triggs ;)
-- A new bug-fix ( for the "!me-command" ) by VidFamne, added ( 09.04.2003 ).
-- Added MatrixX On/Off function. Just type +quiet in mainchat to stop the Bot,
-- and +talk to start the Bot again. By VidFamne ( 05.05.2003 )
-- Bug-fix by [AF]Mike

botname = "robotzel"

trigall=1

trigs = {
             


         ["lol"]={
     "Yeah, [CURUSER] ... Hahahaha .. :P",
     "Hmmmm... lol si eu :D",
     "huh? [CURUSER]  ce-i asa de amuzant ?",
     ":D",
     "incepe sa-mi placa de tine [CURUSER] ... razi cam des :)"           
             
   }


function Main()
frmHub:RegBot(botname)
end

function DataArrival(curUser, data)

status=strsub(data,1,strlen(data)-1)
-- parse the command
s,e,cmd = strfind( status, "%b<>%s+(%S+)" )

if (cmd=="!st") then
trigall=0
SendToAll(botname, " ok.. promit sa fiu cuminte :( ")
return 1
elseif (cmd=="!go") then
trigall=1
SendToAll(botname, " guess who's back? >:)")
return 1
end

       
   if( strsub(data, 1, 1) == "<" ) then
      -- get the msg only using regular expression
      s,e,msg = strfind(data, "%b<>([%a ]+)")                                        
      -- look in the table
                if trigall==1 then
      for key, value in trigs do
                for key2, value2 in value do
                     
   if( strfind( strlower(msg), key) ) then
                 else break  
   end

        if( strfind( strlower(msg), "!me") ) then
                  t="**"..curUser.sName
                  data=gsub (msg, "!me", t, 1 )
   end

      SendToAll( data ) -- send the original data
                   
            SetTimer(1800)
                  StartTimer()
      answer, x = gsub(value[random(1,getn(value))], "%b[]", curUser.sName)

   return 1; -- tell the hub we have processed the data
   end
   end  
   end
end

function OnTimer()
   SendToAll( botname, answer ) -- send bot's answer
   StopTimer()
end
end

I removed all the triggs from this script except the first one to save up space :)

I would really apreciate if someone would help me with all this scripts. They're very small and i don't think they require so much work.  :D

Thank you for your time  8)

Dessamator

for the first script, use nl's lua4 to 5 converter , for the second one, click my signature on my link!
Ignorance is Bliss.

Ubikk

Thanks a lot for the fast reply my friend :)
Oh, i also forgot this little one :)

Quote--ScreenCleaner.lua 1.1 by yepyepyep4711 and Hawk
--!cls will wipe the main chat clean (does that remind you of something? ;) )
--the command will be added to the rightclick menu of the OPs (optional)



botname = "robotzel"

rightclick = 0 -- 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

        if curUser.bVip 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


blackwings

#3
here you go =
--ScreenCleaner.lua 1.1 by yepyepyep4711 and Hawk
--!cls will wipe the main chat clean (does that remind you of something? ;) )
--the command will be added to the rightclick menu of the OPs (optional)
--converted & more compact by blackwings


botname = "robotzel"

rightclick = 0 -- if anything else than 1 rightclick menu won't appear

function ChatArrival (curUser, sData)
	command=string.sub(sData,1,string.len(sData)-1)
	s,e,cmd = string.find(command,"%b<>%s+(%S+)")
	if curUser.bOperator or curUser.bVip 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


6Marilyn6Manson6

#4
QuoteOriginally posted by blackwings
here you go =
--ScreenCleaner.lua 1.1 by yepyepyep4711 and Hawk
--!cls will wipe the main chat clean (does that remind you of something? ;) )
--the command will be added to the rightclick menu of the OPs (optional)
--converted & more compact by blackwings


botname = "robotzel"

rightclick = 0 -- if anything else than 1 rightclick menu won't appear

function ChatArrival (curUser, sData)
	command=string.sub(sData,1,string.len(sData)-1)
	s,e,cmd = string.find(command,"%b<>%s+(%S+)")
	if curUser.bOperator or curUser.bVip 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



This script don't clear really mainchat but send 200lines of button "sending" ;)

Ubikk

yes i know :)

Is there another way of clearing the mainchat? :P

6Marilyn6Manson6

QuoteOriginally posted by Ubikk
yes i know :)

Is there another way of clearing the mainchat? :P

mm i don't things exist other Clear MainChat but you can change line 17

to:

for i=1,200,1 do

in:

for i=1,20000,1 do

and you sending 20000 lines and not 200 :P

blackwings

QuoteOriginally posted by Ubikk
yes i know :)

Is there another way of clearing the mainchat? :P
I dont think so.


blackwings

QuoteOriginally posted by 6Marilyn6Manson6
and you sending 20000 lines and not 200 :P
500 should be enough ;)


6Marilyn6Manson6

QuoteOriginally posted by blackwings
QuoteOriginally posted by 6Marilyn6Manson6
and you sending 20000 lines and not 200 :P
500 should be enough ;)
yeah :)

Ubikk

i've added 400, thanks :)

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

#11
--ScreenCleaner.lua 1.1 by yepyepyep4711 and ??????Hawk??????
--!cls will wipe the main chat clean (does that remind you of something? ;) )
--the command will be added to the rightclick menu of the OPs (optional)
--converted & more compact by blackwings


botname = "robotzel"

rightclick = 0 -- if anything else than 1 rightclick menu won't appear

function ChatArrival (curUser, sData)
	command=string.sub(sData,1,string.len(sData)-1)
	s,e,cmd = string.find(command,"%b<>%s+(%S+)")
	if curUser.bOperator or curUser.bVip then
		if cmd=="!cls" then
			SendToAll(botname, string.rep("\r\n", 10000))
		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

rid that Ugly Loop...  lol

Dessamator

hmm, indeed much more clean , :)
Ignorance is Bliss.

Ubikk

10000 lines? You must be joking :)
it takes the bot 3 seconds to clear the screan.. at least with 400 lines the process is done instantly :P

SMF spam blocked by CleanTalk