Author Topic: Using and not using the hubsoft commands  (Read 1547 times)

0 Members and 1 Guest are viewing this topic.

Offline WooshMan

  • Fulll Member
  • ****
  • Posts: 53
  • Karma: +0/-0
Using and not using the hubsoft commands
« on: 14 February, 2004, 15:33:34 »
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:

Code: [Select]
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

PtokaX forum

Using and not using the hubsoft commands
« on: 14 February, 2004, 15:33:34 »

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #1 on: 15 February, 2004, 06:22:12 »
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 <----<<

Offline WooshMan

  • Fulll Member
  • ****
  • Posts: 53
  • Karma: +0/-0
(No subject)
« Reply #2 on: 15 February, 2004, 11:17:13 »
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:

Code: [Select]

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 :-)
« Last Edit: 15 February, 2004, 14:39:35 by WooshMan »
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

Offline NightLitch

  • Emperor
  • **
  • Posts: 1 455
  • Karma: +16/-0
(No subject)
« Reply #3 on: 16 February, 2004, 00:39:26 »
Nice solusions. but you can do it simpler if you want to.

your code Woosh:
Code: [Select]
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:
Code: [Select]
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

PtokaX forum

(No subject)
« Reply #3 on: 16 February, 2004, 00:39:26 »