Page 1 of 3

[guide/help] Macro usefulls

Posted: 28 Sep 2011, 15:10
by Mortimal
EVAL usefulls

1. Get Char Position

Code: Select all

$x = @eval($::char->{pos}{x})
$y = @eval($::char->{pos}{y})
$x, $y - numbers

2.a. Check if line is Snipable

Code: Select all

$i = @eval (Misc::checkLineSnipable ({x => <your x position>, y => <your y position>}, {x => <target x>, y => <target y>}))
$i - bool

2.b. Check if line is Walkable(have no obstacles)

Code: Select all

$i = @eval (Misc::checkLineWalkable ({x => <your x position>, y => <your y position>}, {x => <target x>, y => <target y>},0))
$i - bool

3. Check if cell is Walkable (and castable)

Code: Select all

$i = @eval($::field->isWalkable(<any x>, <any y>))
$i - bool

4. Get Level of specific Skill

Code: Select all

$i = @eval($::char->getSkillLevel(new Skill(handle => '<skill handle from skillnametable.txt>')))
Image
$i - Skill Level

5. Text to number "array"

Code: Select all

$i = @eval({"<text1>" => <num1>, "<text2>" => <num2>, ..., "<textN>" => <numN>}->{"<textX>"})
$i - number
Example

Code: Select all

$i = @eval({"one" => 1, "two" => 2, "three" => 3}->{"two"})
log $i
result - 2

6. Get Char Stat

Code: Select all

$i = $::char->{<str/agi/dex/int/luc>}
$i - number

7. Check if quest is active

Code: Select all

$i = @eval ($::questList->{'<quest name>'}->{'active'} == 0)
$i - bool
by Tesla27

REGEXP usefulls

1. Not, inside the regexp

Code: Select all

/(?!<not this>)<but this>/
Example:

Code: Select all

console /^(?!You)(.+) finalized the Deal/
Line: "You finalized the deal" - not triggering!
Line: "Player Somebody finalized the deal" - triggering!



That's all for now. To be continued...

P.S.: U can post your usefulls lower and i will put them in head of the topic.

Re: [guide/help] Macro usefulls

Posted: 04 Nov 2011, 20:23
by Dark Airnel
Let's say I want to list all coordinates or blocks between a linesnipeable coordinate how would I do that in a macro. Would it need a sub-macro? Let's say $myx, $myy and $aggrePx, $aggrePy is my coordinate and my enemies coordinate respectively. Provided the coords are found to be snipeable and walkable, how will I calculate through macro the the exact coord where I will be X steps from $aggrePx, $aggrePy. I tried using Utils::moveAlong but it gives me a fixed result of 2/8. The code looks similar to this:

Code: Select all

eval (@eval (Utils::moveAlong ($myPos, $hisPos, $somedist))
That kind of formula always produces 2/8 instead of a coordinate. Am i doing something wrong or is moveAlong not intended for such task?

Re: [guide/help] Macro usefulls

Posted: 05 Nov 2011, 14:40
by EternalHarvest
Utils::moveAlong returns a list, which would be stringifyed by macro plugin's @eval (due to macro plugin's internals). Log the result of @eval and check the string format, or use something like this to retrieve coords inside @eval:

Code: Select all

@eval({moveAlong(...)}->{x})

Re: [guide/help] Macro usefulls

Posted: 05 Nov 2011, 15:31
by mjbm
help for the eval of getting the specific weight of an item.

Re: [guide/help] Macro usefulls

Posted: 07 Nov 2011, 10:52
by EternalHarvest
mjbm wrote:help for the eval of getting the specific weight of an item.
Server doesn't send that info, and there's no such data in openkore so far too.

Re: [guide/help] Macro usefulls

Posted: 12 Jan 2012, 22:51
by Dark Airnel
Mortimal wrote:EVAL usefulls

1. Get Char Position

Code: Select all

$x = @eval($::char->{pos}{x})
$y = @eval($::char->{pos}{y})
$x, $y - numbers
I tried getting the direction where I am facing using the same syntax and the code below does the trick:

Code: Select all

$bdir = @eval($::char->{look}{body})
What if I want to check for the same information from a player how will I do that? I'm thinking of a code that looks like this:
This is to get the direction a certain player is facing or maybe your current target be it a monster or a player.

Code: Select all

$playerbdir = @eval($::player->{look}{body})
The above code does not work by the way. Please help me on how to check for player's information using @eval.

Hope I'm making sense.

Re: [guide/help] Macro usefulls

Posted: 23 Jul 2012, 09:02
by pokamon2
good day, i dont know where to place my question in the forums,

where can i find the functions or keywords to where i can hook plugins::register? i want to learn about scripting with perl. or if there is a list that exist.

or is there a perl documentation of openkore that i can read/use? thank you.


or are some of the keywords that i need are in the Globals.pm? to make my own plugin.

Re: [guide/help] Macro usefulls

Posted: 11 May 2013, 04:26
by bluemachinery
Hi, Need help.

So here is the thing I wanted to do,

So I am done with my quest and I need to log-in a different account so all in all quest has been done and it would be the relog time already.

I just don't get how the loop works, it was given to me before by ezza but it was gone because of the wipe-out of the whole forum and all and I lost it in my files.

So if someone can help me i'd appreciate it, all I need is the loop.

for example:

config.txt is done with quest needs to switch to config2.txt and up to config60.txt and once I get to config60.txt it will switch back to config.txt to form the loop. Hope you can help me.

Re: [guide/help] Macro usefulls

Posted: 03 Jun 2013, 00:48
by kejiaweiren
thank you ,good job
but i also have some questions
for example ,can i get the number of my agi status or other status?
if can ,how?

Re: [guide/help] Macro usefulls

Posted: 15 Aug 2013, 10:39
by Dark Airnel
Dark Airnel wrote:
Mortimal wrote:EVAL usefulls

1. Get Char Position

Code: Select all

$x = @eval($::char->{pos}{x})
$y = @eval($::char->{pos}{y})
$x, $y - numbers
I tried getting the direction where I am facing using the same syntax and the code below does the trick:

Code: Select all

$bdir = @eval($::char->{look}{body})
What if I want to check for the same information from a player how will I do that? I'm thinking of a code that looks like this:
This is to get the direction a certain player is facing or maybe your current target be it a monster or a player.

Code: Select all

$playerbdir = @eval($::player->{look}{body})
The above code does not work by the way. Please help me on how to check for player's information using @eval.

Hope I'm making sense.
It's because Kore doesn't know which player you are referring to.