Using and not using the hubsoft commands
 

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

Using and not using the hubsoft commands

Started by WooshMan, 14 February, 2004, 15:33:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WooshMan

I understand that if I put:

Return 1 in the DataArrival function,  it stops the hubsoft from processing cmds.

Now what if I want to stop the hubsoft processing some commands but not others?

Example:

!help - will use hubsoft !help.  If I have my own !help, it processes both unless I return 1 in the DA but that turns all Hubsoft processing off so I loose commands like !ban user.

I thought this would work, but doesn't:

function DataArrival(user, data)

	if( strsub(data, 1, 1) == "<" ) then
	  data=strsub(data,1,strlen(data)-1)
	  local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
               if cmd == prefix .."help" then
                  MainCommands(user, data)
              	  return 1
               else
                  MainCommands(user, data)
               end
end

but it doesn't work.  When I tried that, any hubsoft command worked except !help.

Any Idea's please?

Thanks

Woosh
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

plop

it all depends where you place the return 1.
for a hint take a look @ crazy bot and then specialy what the global sssst does.
i'll make the hint a bit more clear, sssst starts with being 0.
if a bot command it found it's changed to 1.
next when your done with all the commands you check sssst in dataarrival, if it's 1 you do a return 1.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

WooshMan

#2
Thank you Plop, my idea was right, but scripting wrong....

I have done it as per Cracy Bot and it works a treat... Thanks :-)

Solution:

function DataArrival(user, data)

	xtracmd = 0

	if( strsub(data, 1, 1) == "<" ) then
	MainCommands(user, data)
		if xtracmd == 1 then
		return 1
		end
	end
end


-- cmds file ----
	if cmd == prefix .."help" then
		help(user,data)  --- go and do !help cmd
		xtracmd = 1 -- make sure hubsoft ignores !help and does not run its own !help
	end

Thanks again Plop :-)
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

NightLitch

Nice solusions. but you can do it simpler if you want to.

your code Woosh:
function DataArrival(user, data)

	xtracmd = 0

	if( strsub(data, 1, 1) == "<" ) then
	MainCommands(user, data)
		if xtracmd == 1 then
		return 1
		end
	end
end


-- cmds file ----
	if cmd == prefix .."help" then
		help(user,data)  --- go and do !help cmd
		xtracmd = 1 -- make sure hubsoft ignores !help and does not run its own !help
	end

my code:
function DataArrival(user, data)
	if( strsub(data, 1, 1) == "<" ) then
	      MainCommands(user, data)
	end
end


-- cmds file ----
	if cmd == prefix .."help" then
		help(user,data)  --- go and do !help cmd
		return 1 -- make sure hubsoft ignores !help and does not run its own !help
	end

just so you learn m8.

Talk soon. Visit sometime when hub is up.

/NL
//NL

SMF spam blocked by CleanTalk