Openkore.com

OpenKore Forums
It is currently 21 Oct 2017, 11:44

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: [guide/help] Macro usefulls
PostPosted: 28 Sep 2011, 15:10 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 325
EVAL usefulls

1. Get Char Position
Code:
$x = @eval($::char->{pos}{x})
$y = @eval($::char->{pos}{y})

$x, $y - numbers

2.a. Check if line is Snipable
Code:
$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:
$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:
$i = @eval($::field->isWalkable(<any x>, <any y>))

$i - bool

4. Get Level of specific Skill
Code:
$i = @eval($::char->getSkillLevel(new Skill(handle => '<skill handle from skillnametable.txt>')))

Image
$i - Skill Level

5. Text to number "array"
Code:
$i = @eval({"<text1>" => <num1>, "<text2>" => <num2>, ..., "<textN>" => <numN>}->{"<textX>"})

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

result - 2

6. Get Char Stat
Code:
$i = $::char->{<str/agi/dex/int/luc>}

$i - number

7. Check if quest is active
Code:
$i = @eval ($::questList->{'<quest name>'}->{'active'} == 0)

$i - bool
by Tesla27

REGEXP usefulls

1. Not, inside the regexp
Code:
/(?!<not this>)<but this>/

Example:
Code:
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.

_________________
Please use pin function for uploading your file contents!


Last edited by Mortimal on 07 Feb 2017, 06:32, edited 5 times in total.

Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 04 Nov 2011, 20:23 
Offline
Been there done that!
Been there done that!
User avatar

Joined: 09 Oct 2009, 01:43
Posts: 134
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:
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?


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 05 Nov 2011, 14:40 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1811
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:
@eval({moveAlong(...)}->{x})


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 05 Nov 2011, 15:31 
Offline
Noob
Noob

Joined: 06 Jun 2011, 07:51
Posts: 2
help for the eval of getting the specific weight of an item.


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 07 Nov 2011, 10:52 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1811
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.


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 12 Jan 2012, 22:51 
Offline
Been there done that!
Been there done that!
User avatar

Joined: 09 Oct 2009, 01:43
Posts: 134
Mortimal wrote:
EVAL usefulls

1. Get Char Position
Code:
$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:
$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:
$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.


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 23 Jul 2012, 09:02 
Offline
Noob
Noob

Joined: 30 Oct 2008, 00:58
Posts: 5
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.


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 11 May 2013, 04:26 
Offline
Noob
Noob

Joined: 11 May 2013, 04:20
Posts: 2
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.


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 03 Jun 2013, 00:48 
Offline
Noob
Noob

Joined: 01 Jun 2013, 10:01
Posts: 8
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?


Top
 Profile  
 
 Post subject: Re: [guide/help] Macro usefulls
PostPosted: 15 Aug 2013, 10:39 
Offline
Been there done that!
Been there done that!
User avatar

Joined: 09 Oct 2009, 01:43
Posts: 134
Dark Airnel wrote:
Mortimal wrote:
EVAL usefulls

1. Get Char Position
Code:
$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:
$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:
$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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group