How to autodisconnect when spec item appears in inventory

All resolved question will be found here. It is recommended that you browse / search through this section first and see if your question has been answered before

Moderators: Moderators, Documentation Writers

Message
Author
SlameR
Noob
Noob
Posts: 2
Joined: 22 May 2015, 13:31
Noob?: Yes

How to autodisconnect when spec item appears in inventory

#1 Post by SlameR »

Hello everyone

After reading all the faq and the guide I could find on the wiki, forum and some others posts. I still can't found how to do the specific action I want to.

I've to admit that I'm fairly new on Openkore but I did manage to do some bot by myself (mainly autobuff bots, and hunter bot for farming/xp) thank to all the guides you provided and I'm trying to do my best for understanding much complex scripts.

If anyone can help me, that would be greatly appreciated.

I'm struggling to make my bot auto disconnecting after he receives a particular item in inventory. According to me there is 2 way in which I can to this :

First of all, I could do a macro that would check console messages and make the bot disconnect when it appears.
Secondly, I could do an inventory check and make the bot disconnect if openkore detects the specific item on my inventory.


I did try to found a guide that would explain me how to interprate console messages (in term of scripts with if conditions) but no success and not easy to understand.

This is why I tried to do a simple macro, but not working, got some problems with if statement conditions.

Here is my macro:

Code: Select all

macro start {
  do c @autoloot rate 2
  do c @autoloot item royal jelly
  do c @autoloot item honey
}

automacro dcdrop {
exclusive 1
call {

if inventory "Creamy Card" = 1 goto dc
if inventory "Creamy Card" != 1 goto continue

:dc
charselect

:continue
}
}
Don't bother on the first part of the macro, the second is the one I try to fix.

Is it better to use automacro that trigger for a specific event ?

If anyone can point out my mistakes and explain me how to use these statements correctly, it would be greatly appreciated, I'm learning.

Slamer

User avatar
SkylorD
Moderators
Moderators
Posts: 1167
Joined: 16 Dec 2011, 02:53
Noob?: No
Location: Brazil
Contact:

Re: How to autodisconnect when spec item appears in inventory

#2 Post by SkylorD »

Almost bro.

http://wiki.openkore.com/index.php/Macro_plugin
inventory "<item>" <condition> <amount> [, ...]
Triggers when you have <condition> <amount> of <item> in your inventory.
Comma-separated arguments are treated as OR conditions.
Multiple lines are treated as AND conditions.
There is "console" condition.
console ("<text>" | /<regexp>/)
Triggers when <text> is received on console or the text received matches <regexp>.
The i switch means the regexp is case-insensitive.

Set variables:

$.lastLogMsg - the console text that trigerred the automacro.
$.lastMatchN - backreference from regexp.


Use the search for advanced results. And basics too :D any question, creates another topic.
Learn rules

SlameR
Noob
Noob
Posts: 2
Joined: 22 May 2015, 13:31
Noob?: Yes

Re: How to autodisconnect when spec item appears in inventory

#3 Post by SlameR »

Thank you for your answer SkylorD.

Code: Select all

automacro dcdrop {
inventory "Creamy Card" = 1
call {

logout
}
}
I did check again on the automacro function and it seems like I did a mistake on conditions and complicated myself a bit :).

Now it's working with this simple macro, thank you dude

Locked