Page 1 of 2

Include Help.

Posted: Tue Nov 30, 2004 9:08 pm
by episix
heya, i'm working on an include file that takes "/" commands and preforms the task from /tells.

Code is about 90% taken from Jerles RH mac, but im trying to make it so i can use it with any macro, and yes i know it would prolly be better as a plugin by my programmings skills are still very weak.

Now the "/" commands work whenever the macro isn't preforming a task (i.e. if included in stick.mac as long as the bot isn't attacking anything, the "/" commands work)

If anyone has any way to help, any info is appreciated.

Code: Select all

//1- at the top of your macro put #include slash.inc
//2- Below Sub Main put /echo Slash

#Chat tell 
#Event DoEvent         "[MQ2] Slash"
#Event AddMaster       "[MQ2] AddMaster#*#"
#Event RemMaster       "[MQ2] RemoveMaster#*#"
#Event SetVerbosity    "[MQ2] SetVerbosity#*#"
#Event SetChannel      "[MQ2] SetChannel#*#"

Sub Event_DoEvent

  /declare lastevent string outer None
  /declare verbosity int outer 2
  /declare channel string outer echo
  /declare d int outer 
  
  /if (${verbosity}>=0) /${channel} Setting Aliases...
  
  /squelch /alias /addmaster /echo AddMaster
  /squelch /alias /remmaster /echo RemoveMaster
  /squelch /alias /verbosity /echo SetVerbosity
  /squelch /alias /channel /echo SetChannel
    
  /if (${Ini[SlashCommands.ini,General,Verbosity].NotEqual[NULL]}) /varset verbosity ${Ini[SlashCommand.ini,General,Verbosity]}
  /if (${Ini[SlashCommand.ini,General,Channel].NotEqual[NULL]}) /varset channel ${Ini[SlashCommand.ini,General,Channel]}

  /if (!${Ini[SlashCommand.ini,Masters,Controller1].Length}) {
    |- It's not in there yet
    /for d 1 to 20
      /ini "SlashCommand.ini" "Masters" "Controller${i}" "Nobody"
    /next d
  }
  
/return

Sub Event_AddMaster(string Line)
  /varset lastevent Event_AddMaster
  /declare index int local
  /if (${Line.Arg[3].Length}) {
    /for index 1 to 20
      /if (${Ini[SlashCommand.ini,Masters,Controller${index}].Equal[Nobody]}) {
        /ini "SlashCommand.ini" "Masters" "Controller${index}" "${Line.Arg[3]}"
        /if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} added as a controller...
        /goto :FallOut
      }
    /next index
    /if (${verbosity}>=0) /${channel} ** Master controller slots all filled! Get rid of some!
  } else {
    /if (${verbosity}>=0) /${channel} ** Huh?
  }
  :FallOut
/return

Sub Event_RemMaster(string Line)
  /varset lastevent Event_RemMaster
  /declare index int local
  /if (${Line.Arg[3].Length}) {
    /for index 1 to 20
      /if (${Ini[SlashCommand.ini,Masters,Controller${index}].Equal[${Line.Arg[3]}]}) {
        /ini "SlashCommand.ini" "Masters" "Controller${index}" "Nobody"
        /if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} removed from controller list...
        /goto :FallOut
      }
    /next index
    /if (${verbosity}>=0) /${channel} ** Can't find ${Line.Arg[3]} in access list!
  } else {
    /if (${verbosity}>=0) /${channel} ** Huh?
  }
  :FallOut
/return

Sub Event_Chat(ChatType, Sender, ChatText)
  /varset lastevent Event_Chat
  |- Authenticate if valid controller
  /declare authorized bool local FALSE
  /for d 1 to 20
    /if (${Ini[SlashCommand.ini,Masters,Controller${d}].Equal[${Sender}]}) /varset authorized TRUE
  /next d
  /if (${authorized} && ${ChatText.Left[1].Equal[/]}) {
    /if (${verbosity}>=1) /${channel} ** User ${Sender} Authenticated!
    /if (${verbosity}>=0) /${channel} Doing: "${ChatText}"
    /if (${Me.AFK}) /delay 2s
    /tell ${Sender} As you wish, i will now: ${ChatText}
    /delay 2s
    /docommand ${ChatText}
  }
/return 

Posted: Tue Nov 30, 2004 10:50 pm
by Virtuoso65
I have not tried this but I think it will work.

Code: Select all

/docommand /${tellcommand}
/edit yep it works just ducky

Re: Include Help.

Posted: Wed Mar 05, 2025 5:46 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 5:47 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 5:48 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 5:50 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 5:51 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:04 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:05 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:06 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:07 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:10 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:47 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:48 pm
by xyilla

Re: Include Help.

Posted: Wed Mar 05, 2025 7:49 pm
by xyilla