Author Topic: [TUTORIAL] Scripting Commands  (Read 1116 times)

Hero

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • View Profile
    • http://rev7.net
[TUTORIAL] Scripting Commands
« on: October 19, 2008, 02:05:55 PM »
Examples of how to do command input that will respond to Whispers, Chat, and InBot (/)

[size=]FoolOps:[/size]

Code: [Select]
'// Command Input Example
'// 1.0 - By Hero

Function Event_ParseCommand(Command, Rest, Username, Access, Inbot, Whispered)

  '// Select a case of the command, convert it all to lowercase so that it is not case sensitive
  Select Case LCase(Command)

    Case "bye" '// If the command is bye
      AddQ "Bye!"   '// Send the text Bye! to battle.net
    
    Case "hi", "hello"    '// If the command is hi or hello
      AddQ "Hi!"   '// Send text to battle.net

    Case "boot"  '// If the command is boot
      '// Let's kick this person
      '// Check if they said a person to boot
      If Args = vbNullString Then  '// They didn't have arguments
        '// Since they said nobody let's kick them
        AddQ "/kick " & Username
      Else '// They have arguments
        AddQ "/kick " & Rest '// Kick the person they said
      End If

    Case "access" '// If the command is access
      '// This command takes 10 access to use
      If Access < 10 Then Exit Function '// They have less than 10 access. Exit the command input
      AddQ "You have " & Access & " access."
      
  End Select

End Function

[size=]Stealthbot:[/size]

Code: [Select]
'cmdex
'1.0
'&Command Input Example:Hero

'// Setup the events and have them call a CommandInput sub so that we can handle whispers, chat, and inbot all at once

Sub cmdex_Event_Usertalk(Username, Flags, Message, Ping)
  Call cmdex_CommandInput(Username, Message, Flags, 1)
End SUb

Sub cmdex_Event_PressedEnter(Text)
  Call cmdex_CommandInput(BotVars.Username, Text, botFlags, 4)
End Sub

Sub cmdex_Event_WhisperFromUser(Username, Flags, Message)
  Call cmdex_CommandInput(Username, Message, Flags, 3)
End Sub

'// Command Input
Sub cmdex_CommandInput(Username, Text, Flags, Source)

  '// Check for the trigger, exit if they didn't use it
  If Left(Text, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub
  
  '// Get the arguments and cut off the trigger
  Arg = Split(Mid(Text, Len(BotVars.Trigger) + 1))
  
  '// Get the user's access
  GetDBEntry Username, uAccess, uFlags
  
  '// Select case that first word
  Select Case LCase(Arg(0))
  
    Case "bye" '// If the command is bye
      Dsp Source, "Bye!", Username, vbGreen  '// Send the text
    
    Case "hi", "hello"    '// If the command is hi or hello
      Dsp Source, "Hi!", Username, vbGreen   '// Send text
      
    Case "boot"  '// If the command is boot
      '// Let's kick this person
      '// Check if they said a person to boot
      If Arg = vbNullString Then  '// They didn't have arguments
        '// Since they said nobody let's kick them
        AddQ "/kick " & Username
      Else '// They have arguments
        AddQ "/kick " & Arg(1) '// Kick the person they said
      End If

    Case "access" '// If the command is access
      '// This command takes 10 access to use
      If uAccess < 10 Then Exit Sub '// They have less than 10 access. Exit the command input
      Dsp Source, "You have " & Access & " access.", Username, vbGreen
  
  End Select
End Sub
« Last Edit: October 27, 2008, 02:35:51 PM by Hero »
Hero
AKA: HeroAssasin and Mike
- - - - -  - - -
Visit Clan R77
- - - - -  - - -
Please do not PM me with random questions. That is what I made these forums for.

Noob ~Vector

ArticWolve

  • Global Moderators
  • Hero Member
  • *****
  • Posts: 636
    • View Profile
    • http://
[TUTORIAL] Scripting Commands
« Reply #1 on: October 19, 2008, 02:30:04 PM »
Didn't you forget the Stealth bot command example...
Quote
Darker then the darkest shade of night...
    A Rebel at heart... A criminal by mind
    All in the eyes of the beholder... is the truth to life
    But Th---The Only---The One and Only True Master of Death is the Reaper itself
[/color]
[/color]
[div align=\'center\'][img]http://img261.imageshack.us/img261/9411/mydesktopce6.jpg\" border=\"0\" class=\"linked-sig-image\" /][img]http://www.danasoft.com/sig/238153.jpg\" border=\"0\" class=\"linked-sig-image\" /][/div]                     [div align=\'center\']    Click ME for my forums. You know you want to click ME. Come on CLICK ME DAMN IT! But don't click THIS!![/div]

Hero

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • View Profile
    • http://rev7.net
[TUTORIAL] Scripting Commands
« Reply #2 on: October 19, 2008, 02:56:54 PM »
Finished Stealthbot command input example
Hero
AKA: HeroAssasin and Mike
- - - - -  - - -
Visit Clan R77
- - - - -  - - -
Please do not PM me with random questions. That is what I made these forums for.

Noob ~Vector

Hero

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • View Profile
    • http://rev7.net
[TUTORIAL] Scripting Commands
« Reply #3 on: October 19, 2008, 02:57:04 PM »
I have moved this topic to the Scripting Tutorials/FAQS area.
Hero
AKA: HeroAssasin and Mike
- - - - -  - - -
Visit Clan R77
- - - - -  - - -
Please do not PM me with random questions. That is what I made these forums for.

Noob ~Vector