Page 4 of 7

Re: Warp Portal macro

Posted: 09 Apr 2009, 02:08
by ezza
It return your standing point just becoz any of the reasons below:

1. The $_l returns nothing
2. Failed to create an array/variable by @areas

When the $_z is an empty string... anything + empty equals to just anything (your x or y position)



P.s: Cheer up .. dont be sad. This is only the beginning... you'll face more problems in future. Just ask whatever that bothers you.


[Edit]
Maybe you've wrongly put the coordinates in the @_areas? To be honest... there is nothing wrong playing with the array like you've suggested. Its just that the eval is too easily get syntax error or misscoded and we sometimes didnt/couldnt realize it.

Re: Warp Portal macro

Posted: 09 Apr 2009, 02:54
by Darki
I'm not sad, it's jut that I'm a little tired of it. xD It gets wrong coordinates and this time I did the table correctly, in fact I posted in the perl forum too (though there was nothing about OpenKore, I went there just to learn a little more perl), and that was written by another person and revised by me, so I don't know what could happen. :| In case the string gets undefined the solution is easy, just adding an "if ($loc == $.pos) goto noskill", but anyways I dont know, I'll redo the tables again an try then when I'm done with my other stuff.

Anyways, don't worry, I'm not taking a break for this, it's just that I need some days to solve some stuff, like finishing some designs Ive been working on, and getting a life. xD I've been to obsessed with the computer those days and I need to do university work, I need to take it serious and do my exams before getting again into this. Probably I'll be around till Sunday and then take a week or two. :D

Re: Warp Portal macro

Posted: 09 Apr 2009, 03:11
by ezza
Have you really tested the last code yourself without modified anything? It works on me... just that I dont know the actual direction (i dont have any RO client) but the coordinate will never be our standing spot.



p.s: The reason why I ask about my happy time is I'm too confident that it will work. I've tested it several times and all working fine.. so, I wonder what is your actual prob there.

Re: Warp Portal macro

Posted: 09 Apr 2009, 05:34
by Darki
EDIT: Alll I did was copy&paste your code and change the macro thingy to make it an automacro (added a trigger and changed the "log $loc" by an "do sl 27 $loc"). I've done it in my iRO: Valkyrie account too, so it seems we can forget about the servers.txt problem. I changed the macro just because I though it'd be better to test with the real skill, so if there are problems like the snipable thing or something it'd work. Sometimes it fails because it tries to cast a skill in a wrong spot, so the log doesn't work properly because it will log a spot even if it's a wrong one.

The locations are still werd because it sometimes get weird positions. For example, it was facing north and when I triggered the macro, it turned back and casted the skill at south. Another thing is that if it faces a "map limit" instead of a building or something, it fails too, or at least that happened before when I tried. I was inside a building to avoid people, and instead of making it face a wall I just put it at the limit of the area and triggered the macro, and instead of telling it was a wrong spot it tried to cast the skill without knowing there was no floor there. When there's an obstacle it sometimes get spots out of order, and the weirdest thing is that, sometimes it takes spots that weren't listed in any ways. For example a spot [0,1], let's call it, a spot that is only a square far, it's not listed because it should check only spots from two squares further, but it casted the skill near itself in some cases.

For that I don't really know what can happen. It works but it still have problems, I don't know if I should just get over it and use the code that works the best instead of trying to make a "perfect one"? Anyways it's not a big code, seriously I don't know what in hell can happen. xD

Re: Warp Portal macro

Posted: 09 Apr 2009, 06:52
by ezza
I know how frustrated you are after trying very hard to get what you want. I cant say or simply say I dont know what is happening actually since the code is not really a complex one.. instead, it really is a simple perl line to understand. I think the reason it might failed is becoz of the unwisely coordinating the @areas arrays. You need to understand that the best way of coordinating the coordinates is listing it from near spot to far spot. So that in any case there wont be any jumping spots check (based on the closestWalkableSpot basic function). I'm not intend to write the full @areas now.. just for $look = 0 (its easy)

Code: Select all

[[0,1],[-1,1],[1,1], [0,2],[-1,2],[1,2],[-2,2],[2,2], [0,3],[-1,3],[1,3],[-2,3],[2,3],[-3,3],[3,3], [0,4],[-1,4],[1,4],[-2,4],[2,4],[-3,4],[3,4],[-4,4],[4,4], [0,5],[-1,5],[1,5],[-2,5],[2,5],[-3,5],[3,5],[-4,5],[4,5],[-5,5],[5,5], [0,6],[-1,6],[1,6],[-2,6],[2,6],[-3,6],[3,6],[-4,6],[4,6],[-5,6],[5,6],[-6,6],[6,6]]
#row by row
So if we set the above arrays and use foreach loop to list it all... the result will always in the order of that listing.. starts with [-1,1] and ending with [6,6]


ahh 1 more thing... as i said before.. it return your standing spot becoz of the empty arrays... use _ (underscore) to prevent that just like my last example.

Re: Warp Portal macro

Posted: 09 Apr 2009, 22:18
by Darki
Actually the coding was somewhat messy but if we take it into a spiral for example it will be always from a spot to another, so maybe that's a solution. I'll write the new one and try after lunch (so in two hours or so).

EDIT: I've looked your code better and I see you used many more spots than I wanted to use this time. the problem is that I want it to check by radius, so given the central spot ([0,4]), it will check first the closest spots to that one ([0,3],[1,3],[1,4]...). I can try not to make "jumps" in spots by just making some kind of spiral, but I can't follow an exact order like yours from the first point. Is that a so bad problem? I mean, I don't know why it fails to check spots that are separated, for the Kore internals that should only be numbers, what if you NEED to check them without order, for another kind of use? ._.

One solution for the undef $_l would be to add a first check before anything and if it's undefined directly terminate the macro. It could halp to work, and after the bot walks a little randomly it will get the first look data and work normally.

(Just to note, I've used your exact code the last checks, so the underline thing too, and it still gets wrong spots so maybe that's not the problem).

Another thing I was thinking, whould we also add a lineSnipable check? (or maybe a lineWalkable). This is just a guess, because I didn't test it with my own hands (meaning to play myself with the Acolyte character and check in what cases the skill can be cast), but it seems it can't use the skill if there's an obstacle between the caster and the player. I don't know if you could cast it from a cliff or at the other side of a wall but that's easy to check.

I'm talking about ANOTHER check just because it seems the problem is in the spot assignement, since the only bugs I had were on that. You can kill me if you want. :lol: Once we have the spots thing cleared I can do experiments on this.

P.s: Yes, sometimes I'm S&M, I like to annoy myself. :oops:

Re: Warp Portal macro

Posted: 09 Apr 2009, 23:20
by ezza
Darki wrote:...EDIT: I've looked your code better and I see you used many more spots than I wanted to use this time. the problem is that I want it to check by radius, so given the central spot ([0,4]), it will check first the closest spots to that one ([0,3],[1,3],[1,4]...). I can try not to make "jumps" in spots by just making some kind of spiral, but I can't follow an exact order like yours from the first point. Is that a so bad problem? I mean, I don't know why it fails to check spots that are separated, for the Kore internals that should only be numbers, what if you NEED to check them without order, for another kind of use? ._.

Ermm.. no wonder you easily make mistakes ^^. Related to $look = 0, [0,4] means x = 0 in row 4. Now we dont wanna talk about the y... we just say it "row". This is how the row 4 should be (based on the closest spot from [0,0] your pos)

Code: Select all

[0,4],[-1,4],[1,4],[-2,4],[2,4],[-3,4],[3,4],[-4,4],[4,4]

Just to make it easy for you...

Image

So $look = 0 is :

Code: Select all

[[0,1],[-1,1],[1,1], [0,2],[-1,2],[1,2],[-2,2],[2,2], [0,3],[-1,3],[1,3],[-2,3],[2,3],[-3,3],[3,3], [0,4],[-1,4],[1,4],[-2,4],[2,4],[-3,4],[3,4],[-4,4],[4,4], [0,5],[-1,5],[1,5],[-2,5],[2,5],[-3,5],[3,5],[-4,5],[4,5],[-5,5],[5,5], [0,6],[-1,6],[1,6],[-2,6],[2,6],[-3,6],[3,6],[-4,6],[4,6],[-5,6],[5,6],[-6,6],[6,6]]

Re: Warp Portal macro

Posted: 09 Apr 2009, 23:49
by Darki
That stunned me. O.O Then I just need to add then in order and the program will choose them based on proximity? I'm lost... ._.

Re: Warp Portal macro

Posted: 10 Apr 2009, 00:17
by ezza
Dont tell me you never take math or culculus or the very basic X-axis Y-axis chart :shock: . All the coordinates in the map were based on the chart.

Basic knowledge...

Centre - North = 0 .. 6 (Y-axis)
Centre - East = -1 .. -6 (X-axis)
Centre - West = 1 .. 6 (X-axis)
Centre - South = -1 .. -6 (Y-axis)

$look = 0 { NE red line to NW red line}
$look = 1 { Upper-Right Blocks (N->W) }
$look = 2 { NW red line to SW red line }
$look = 3 { Down-Right Blocks (S->W) }
$look = 4 { SW red line to SE red line }
$look = 5 { Down-Left Blocks (S->E) }
$look = 6 { SE red line to NE red line }
$look = 7 { Upper-Left Blocks (N->E) }

Re: Warp Portal macro

Posted: 10 Apr 2009, 00:26
by Darki
I know the coordinate math, but I'm starting to doubt how do the perl location work.

So, if I make the bot to seach for the squares in a certain order, should I put the squares in THAT order, or just put the squares based on proximity and the kore does the rest of the work? that's why I'm confused now.

for your S_l = 0 chart, I understand perfectly the square selection, you took all the squares between the two upper bisectors, so you did a triangle covering that area. What I want to do, is different, it's a circular area INSIDE that triangrle, where you use the central point as the first place to check and then go checking them in a radius.

For example, for the north coordinates ($_l = 0) it'd be this:
Image

while for the northwest coordinates ($_l = 1) it'd look like this:
Image

being the yellow spot the "0,0", where the character stands.

for the $_l = 0, 2, 4 or 6 it will look like the red example, while for the diagonal ones it would look like the green. it would start in the center (the lighter square) and check first the closer squares to that one, then the further, till reach the last squares of the area.