Results 1 to 4 of 4

Thread: Message commands

  1. #1
    Normal User
    Join Date
    Feb 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    3

    Question Message commands

    Hi guys... Im trying to make a action who the commander gives a order by private message and the bot do the action.

    for example:

    ----------

    commander = "nameGoHere"
    cast1 = "go to protect"
    cast2 = "back to hunt"

    if getnewmessages.sender == commander and getnewmessages.text == cast1 then

    gotolabel("goPZ")

    else if getnewmessages.sender == commander and getnewmessages.text == cast2 then

    gotolabel("goHunt")

    end

    ----------


    anyone can help me? Thanks!!!

  2. #2
    Premium User
    Join Date
    Jun 2012
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    5
    nice idea, this work?

  3. #3
    Normal User
    Join Date
    Jun 2012
    Location
    Sweden
    Posts
    1,671
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    8 Post(s)
    Reputation
    132
    Rep Power
    9
    Lua Code:
     
    --<Setup>
    commander = {"name","Another name if wanted"} -- can be multiple names
    cast1 = "go to protect"
    cast2 = "back to hunt"
    --</Setup>
     
    local MESSAGES = getnewmessages("Local Chat")
    local MESSAGES_QUANTITY = MESSAGES.count - 1
     
    for INDEX = 0, MESSAGES_QUANTITY do
    	local MSG = MESSAGES[MESSAGES_QUANTITY - INDEX]
    	if table.find(commander,MSG.sender) then
    		if MSG.text:find(cast1) then
    			gotolabel("goPZ")
    			break
    		elseif MSG.text:find(cast2) then
    			gotolabel("goHunt")
    			break
    		end
    	end
    end
    Last edited by soder; 03-23-2014 at 01:29 PM.

  4. #4
    Focus Group mexicowss's Avatar
    Join Date
    May 2012
    Location
    Brasil
    Posts
    440
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    59 Post(s)
    Reputation
    128
    Rep Power
    6
    .....
    Last edited by mexicowss; 03-24-2014 at 06:32 AM.
    click the image below to see my thread.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •