Eval Trigger Automacro

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

Lethor
Noob
Noob
Posts: 6
Joined: 26 Jan 2014, 08:52
Noob?: No

Eval Trigger Automacro

#1 Post by Lethor »

Hi,

i want to write a automacro being triggered by some items in my inventory.

the condition should be 25/(@invamount(x)+@invamount(y)) > 1
i tried something like that

Code: Select all

sub thiefSub {
  if (25/(@invamount(x)+@invamount(y)) > 1 {
    return 1;
  }
  else {
    return 0;
  }
}
automacro thiefcon {
  eval main::thiefSub()
  run-once 1 
  call {
it seems that i can't use the @invamount expression in the subroutine....
how to solve this
Puding
Human
Human
Posts: 38
Joined: 29 Jan 2009, 00:24
Noob?: No

Re: Eval Trigger Automacro

#2 Post by Puding »

Err... Why don't you use "Inventory" instead?

Like, do relog if I have 1 jellopy:

Code: Select all

automacro relog {
exclusive 1
inventory "Jellopy" == 1
call {
do relog
}
}
And no, you can't use @inventory, it's a macro expression.

Sorry If I don't get what you need =p
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: Eval Trigger Automacro

#3 Post by Kaspy »

Wrong

Code: Select all

  }
  else {
Correct

Code: Select all

  } else {
In any other language you could type the first way, but I did not allow it in Macro Plugin because many who use it are amateurs, they would be confused on the difference in syntax.
Image
Lethor
Noob
Noob
Posts: 6
Joined: 26 Jan 2014, 08:52
Noob?: No

Re: Eval Trigger Automacro

#4 Post by Lethor »

inventory won't work for this. and it doesn't work at all for me... dunno why.
well i just trigger my automacro with item pickup console output.. not pretty but works
c4c1n6kr3m1
The Way Of Human
The Way Of Human
Posts: 150
Joined: 24 Mar 2012, 04:13
Noob?: Yes

Re: Eval Trigger Automacro

#5 Post by c4c1n6kr3m1 »

Code: Select all

automacro thiefcon {
  eval (25/(Misc::inInventory("x")+Misc::inInventory("y")) > 1
  run-once 1 
  call yourmacro
}
***edited: opps, wrong function, only return index. use this:
eval (25/((Match::inventoryItem("x")->{amount})+(Match::inventoryItem("y")->{amount}))) > 1