Page 5 of 7

Re: Warp Portal macro

Posted: 10 Apr 2009, 01:04
by ezza
Its still the same for me... I mean the listing coordinates. I dont see why its wrong, the listing will go just like what you told the array.. exactly the same. If the array is right(your coordinates list), how come it drop into some weird place.


Suggestion: Make the bot move 1st before asking it to list the coordinates. There is an undefined $look for some cases.


Ahh sorry... isnt that is North East? $look = 7?

Re: Warp Portal macro

Posted: 10 Apr 2009, 01:24
by Darki
North east is $_l = 7, yeah. And I believe I did well the codes, that's why I don't know why it goes to a weird location. I don't use the macro right when I log, so there shouldn't be undefined looks neither, I usually take the bot somewhere and then use the macro... This is annoying, seriously. I've checked the coordinates over and over again, I don't know what's wrong unless the problem is not a mistake, but a lack of knowledge.

Re: Warp Portal macro

Posted: 10 Apr 2009, 03:08
by ezza
Ermm... could you post the latest macro of yours. Seriously... I feels like the weird result came from human mistakes... I'll try to figure it out for the last and forever.



Or the map(server map) != OK (field map). I've encounter this prob with my 1st setup in KoreRO (map = morocc town)... they use episode 12 morocc town (centre of morocc destroyed) while my field is only at episode 11 (still can walk at the morocc centre). So, the bot stuck how to take the nearest route to upper map since it taught that the route is exist but its not... So, maybe this is your problem. The rest probably... I dont know.

Re: Warp Portal macro

Posted: 10 Apr 2009, 04:05
by Darki
My FULL macro is this:

Code: Select all

automacro warpCall {
	console /\(From: (.*)\) : open warp portal/i
	exclusive 1
	call {
		if (@eval (defined $::overallAuth{"$.lastMatch1"} ? $::overallAuth{"$.lastMatch1"}:"None") != 1) stop
		if (@invamount (Blue Gemstone) > 0) goto blue
		do pm "$.lastMatch1" I need a Blue Gemstone.
		stop
	:blue
		do eval undef $::Macro::Data::varStack{loc};my $_l = $::char->{look}{body};return if (!defined $_l);my @_areas = ( [[0,4],[0,3],[-1,3],[1,3],[-1,4],[1,4],[-1,5],[1,5],[0,5],[0,2],[-1,2],[1,2],[-2,2],[2,2],[-2,3],[2,3],[-2,4],[2,4],[-2,5],[2,5],[-2,6],[2,6],[-1,6],[1,6],[0,6]] , [[-3,3],[-3,2],[-2,3],[-4,3],[-3,4],[-2,2],[-3,1],[-1,3],[-4,2],[-2,4],[-5,3],[-3,5],[-4,4],[-2,1],[-1,2],[-3,0],[0,3],[-4,1],[-1,4],[-5,2],[-2,5],[-6,3],[-3,6],[-5,4],[-4,5]] , [[-4,0],[-3,0],[-3,-1],[-3,1],[-4,-1],[-4,1],[-5,-1],[-5,1],[-5,0],[-2,0],[-2,-1],[-2,1],[-2,-2],[-2,2],[-3,-2],[-3,2],[-4,-2],[-4,2],[-5,-2],[-5,2],[-6,-2],[-6,2],[-6,-1],[-6,1],[-6,0]] , [[-3,-3],[-2,-3],[-3,-2],[-3,-4],[-4,-3],[-2,-2],[-1,-3],[-3,-1],[-2,-4],[-4,-2],[-3,-5],[-5,-3],[-4,-4],[-1,-2],[-2,-1],[0,-3],[-3,0],[-1,-4],[-4,-1],[-2,-5],[-5,-2],[-3,-6],[-6,-3],[-4,-5],[-5,-4]] , [[0,-4],[0,-3],[1,-3],[1,-3],[1,-4],[-1,-4],[1,-5],[-1,-5],[0,-5],[0,-2],[1,-2],[-1,-2],[2,-2],[-2,-2],[2,-3],[-2,-3],[2,-4],[-2,-4],[2,-5],[-2,-5],[2,-6],[-2,-6],[1,-6],[-1,-6],[0,-6]] , [[3,-3],[3,-2],[2,-3],[4,-3],[3,-4],[2,-2],[3,-1],[1,-3],[4,-2],[2,-4],[5,-3],[3,-5],[4,-4],[2,-1],[1,-2],[3,0],[0,-3],[4,-1],[1,-4],[5,-2],[2,-5],[6,-3],[3,-6],[5,-4],[4,-5]] , [[4,0],[3,0],[3,1],[3,-1],[4,1],[4,-1],[5,1],[5,-1],[5,0],[2,0],[2,1],[2,-1],[2,2],[2,-2],[3,2],[3,-2],[4,2],[4,-2],[5,2],[5,-2],[6,2],[6,-2],[6,1],[6,-1],[6,0]] , [[3,3],[2,3],[3,2],[3,4],[4,3],[2,2],[1,3],[3,1],[2,4],[4,2],[3,5],[5,3],[4,4],[1,2],[2,1],[0,3],[3,0],[1,4],[4,1],[2,5],[5,2],[3,6],[6,3],[4,5],[5,4]] ); my @_area = @{$_areas[$_l]};my $_skip;foreach my $_z (@_area) {my ($_x, $_y) = ($::char->{pos}{x} + $_z->[0], $::char->{pos}{y} + $_z->[1]);$_skip = 1;next if (!$::field->isWalkable($_x, $_y));$_skip = 0;foreach my $_npc (@{$::npcsList->getItems()}) {next if ($_npc->{pos_to}{x} != $_x || $_npc->{pos_to}{y} != $_y);$_skip = 1;last;} next if ($_skip);foreach my $_pl (@{$::playersList->getItems()}) {next if ($_pl->{pos_to}{x} != $_x || $_pl->{pos_to}{y} != $_y);$_skip = 1;last;} next if ($_skip);$::Macro::Data::varStack{loc} = $_x ." ". $_y;last} if ($_skip) {$::Macro::Data::varStack{loc} = "none";}
                        if ($loc = "") goto end

		do sl 27 $loc
		pause 2
		call warpList
		do pm "$.lastMatch1" where to?
                        stop
                    :end
                        log You are not looking at anywhere!
	}
 }

	macro warpList {
		do pm "$.lastMatch1" Those are my current saved maps:
		$i = 0
		[
		while ($i <= 3) as warploop
		do eval $::Macro::Data::varStack{warpRSW} = $::maps_lut{$::char->{warp}{memo}[$i].'.rsw'} ? $::maps_lut{$::char->{warp}{memo}[$i].'.rsw'}:"none"
		do eval $::Macro::Data::varStack{warp} = $::char->{warp}{memo}[$i] ? $::char->{warp}{memo}[$i]:"none"
		do pm "$.lastMatch1" @eval ($i + 1). "$warpRSW" [$warp]
		$i++
		end warploop
		]
	}

automacro warpOpen {
	console /\(From: (.*)\) : (1st|2nd|3rd|4th) warp/i
	exclusive 1
	call {
		if (@eval (defined $::overallAuth{"$.lastMatch1"} ? $::overallAuth{"$.lastMatch1"}:"None") != 1) stop
		do eval $::Macro::Data::varStack{cast} = $::char->{warp}{memo}[0] ? $::char->{warp}{memo}[0]:"none"
		if ("$cast" == "none") stop
		if ("$.lastMatch2" == "4th") goto four
		if ("$.lastMatch2" == "3rd") goto three
		if ("$.lastMatch2" == "2nd") goto two
		$dest = 0
		goto dest
	:two
		$dest = 1
		goto dest
	:three
		$dest = 2
		goto dest
	:four
		$dest = 3
	:dest
		do warp $dest
		do eval $::Macro::Data::varStack{warpDest} = $::maps_lut{$::char->{warp}{memo}[$dest].'.rsw'}
		do pm "$.lastMatch1" Warp opened! Destination: $warpDest!
		if (@config (follow) == 0) stop
		pause 10
		do move $nx $ny
	}
}
But as I didn't need to check the list because all I wanted was to know if the skill was located correctly, I just put an "#" in front of the "call warpList". I also put a "log $loc" and "log $.pos" to check easily the positions on console.

I've tested this macro in Einbroch, in Moscovia, inside Einbroch (the inn where you can save) and in Payon. The first place was Moscovia and I switched to other places because I guessed the map could be buggy for being a very recent one, but my OK is the SVN version and I update it very often, so if there's a problem it must be there, I've never modded the maps.

Re: Warp Portal macro

Posted: 10 Apr 2009, 04:44
by ezza
I've edited your macro abit... just like I've predicted... the macro gone weird when undefined look. I've told you for so many times that when you change map,login,teleport,enter the warp, and etc... the look will become undefined. Test it 1st and report me ASAP.

Re: Warp Portal macro

Posted: 10 Apr 2009, 06:17
by Darki
The macro still goes weird when there are obstacles. Yes, this time it told me when there was not set the look variable, but that happened only once and I did it on purpose (relog and cast the skill), in most of the times I make it walk a little so there MUST be defined. It still tried to cast the skill on itself again once, and in some directions it seems the spot is not correct, so I guess I'll rewrite AGAIN the coordinates. For example, I went near a medium obstacle covering half of the area (one side) an NPC and my other account there too. There was like half of the sports free (basically it was covered the central one, one below and all left ones) and instead of casting it at right side it turned back and cast the spot somewhere else... My only option is that there's a wrong script in the coordinates AGAIN... :/ I'll post them as soon as I rewrite them, so you can check if you want. When I have all eight coordinates I'll rewrite the eval with them.
north ($_l = 0): [[0,4],[0,3],[-1,3],[1,3],[-1,4],[1,4],[-1,5],[1,5],[0,5],[0,2],[-1,2],[1,2],[-2,2],[2,2],[-2,3],[2,3],[-2,4],[2,4],[-2,5],[2,5],[-2,6],[2,6],[-1,6],[1,6],[0,6]]

northwest ($_l = 1): [[-3,3],[-3,2],[-2,3],[-4,3],[-3,4],[-2,2],[-3,1],[-1,3],[-4,2],[-2,4],[-5,3],[-3,5],[-4,4],[-2,1],[-1,2],[-3,0],[0,3],[-4,1],[-1,4],[-5,2],[-2,5],[-6,3],[-3,6],[-5,4],[-4,5]]

west ($_l = 2): [[-4,0],[-3,0],[-3,-1],[-3,1],[-4,-1],[-4,1],[-5,-1],[-5,1],[-5,0],[-2,0],[-2,-1],[-2,1],[-2,-2],[-2,2],[-3,-2],[-3,2],[-4,-2],[-4,2],[-5,-2],[-5,2],[-6,-2],[-6,2],[-6,-1],[-6,1],[-6,0]]

southwest ($_l = 3): [[-3,-3],[-2,-3],[-3,-2],[-3,-4],[-4,-3],[-2,-2],[-1,-3],[-3,-1],[-2,-4],[-4,-2],[-3,-5],[-5,-3],[-4,-4],[-1,-2],[-2,-1],[0,-3],[-3,0],[-1,-4],[-4,-1],[-2,-5],[-5,-2],[-3,-6],[-6,-3],[-4,-5],[-5,-4]]

south ($_l = 4): [[0,-4],[0,-3],[1,-3],[-1,-3],[1,-4],[-1,-4],[1,-5],[-1,-5],[0,-5],[0,-2],[1,-2],[-1,-2],[2,-2],[-2,-2],[2,-3],[-2,-3],[2,-4],[-2,-4],[2,-5],[-2,-5],[2,-6],[-2,-6],[1,-6],[-1,-6],[0,-6]]

southeast ($_l = 5): [[3,-3],[3,-2],[2,-3],[4,-3],[3,-4],[2,-2],[3,-1],[1,-3],[4,-2],[2,-4],[5,-3],[3,-5],[4,-4],[2,-1],[1,-2],[3,0],[0,-3],[4,-1],[1,-4],[5,-2],[2,-5],[6,-3],[3,-6],[5,-4],[4,-5]]

east ($_l= 6): [[4,0],[3,0],[3,1],[3,-1],[4,1],[4,-1],[5,1],[5,-1],[5,0],[2,0],[2,1],[2,-1],[2,2],[2,-2],[3,2],[3,-2],[4,2],[4,-2],[5,2],[5,-2],[6,2],[6,-2],[6,1],[6,-1],[6,0]]

northeast ($_l = 7): [[3,3],[2,3],[3,2],[3,4],[4,3],[2,2],[1,3],[3,1],[2,4],[4,2],[3,5],[5,3],[4,4],[1,2],[2,1],[0,3],[3,0],[1,4],[4,1],[2,5],[5,2],[3,6],[6,3],[4,5],[5,4]]
EDIT: I'm 90% sure I made a mistake in the tables now, because in some of them I just tweaked the minus signs because they were very alike and most probably I shitted it somewhere. But, I'm not sure at all so I'll just redo it AGAIN this time writting each number one by one. :/ I hope that's the last problem and we can make this work correctly, but I feel really stupid making mistakes in this so many times. :cry:

Re: Warp Portal macro

Posted: 10 Apr 2009, 06:59
by ezza
Darki wrote:... I'm 90% sure I made a mistake in the tables now...
Thank God... I really hope that it was your mistakes and if it is true... I really wana give your butt a 100 damn public-canning. :)



[Edit]
Errr... 0 --> 7 is clockwise or anti-clockwise? just wanna be sure ^^

Re: Warp Portal macro

Posted: 10 Apr 2009, 07:05
by Darki
I deserve it. :oops:

(But don't be too confident about it, it'd be too beautiful to be true that it worked finally. xD)

EDIT: The $::char->{look}{body} is anti-clockwise, that is not wrong, I tested it many times. xD


Here's the new "final" macro. xD

Code: Select all

automacro login {
	hook in_game
	exclusive 1
	run-once 1
	call {
		do eval @_areas = ( [[0,4],[0,3],[-1,3],[1,3],[-1,4],[1,4],[-1,5],[1,5],[0,5],[0,2],[-1,2],[1,2],[-2,2],[2,2],[-2,3],[2,3],[-2,4],[2,4],[-2,5],[2,5],[-2,6],[2,6],[-1,6],[1,6],[0,6]] , [[-3,3],[-3,2],[-2,3],[-4,3],[-3,4],[-2,2],[-3,1],[-1,3],[-4,2],[-2,4],[-5,3],[-3,5],[-4,4],[-2,1],[-1,2],[-3,0],[0,3],[-4,1],[-1,4],[-5,2],[-2,5],[-6,3],[-3,6],[-5,4],[-4,5]] , [[-4,0],[-3,0],[-3,-1],[-3,1],[-4,-1],[-4,1],[-5,-1],[-5,1],[-5,0],[-2,0],[-2,-1],[-2,1],[-2,-2],[-2,2],[-3,-2],[-3,2],[-4,-2],[-4,2],[-5,-2],[-5,2],[-6,-2],[-6,2],[-6,-1],[-6,1],[-6,0]] , [[-3,-3],[-2,-3],[-3,-2],[-3,-4],[-4,-3],[-2,-2],[-1,-3],[-3,-1],[-2,-4],[-4,-2],[-3,-5],[-5,-3],[-4,-4],[-1,-2],[-2,-1],[0,-3],[-3,0],[-1,-4],[-4,-1],[-2,-5],[-5,-2],[-3,-6],[-6,-3],[-4,-5],[-5,-4]] , [[0,-4],[0,-3],[1,-3],[-1,-3],[1,-4],[-1,-4],[1,-5],[-1,-5],[0,-5],[0,-2],[1,-2],[-1,-2],[2,-2],[-2,-2],[2,-3],[-2,-3],[2,-4],[-2,-4],[2,-5],[-2,-5],[2,-6],[-2,-6],[1,-6],[-1,-6],[0,-6]] , [[3,-3],[3,-2],[2,-3],[4,-3],[3,-4],[2,-2],[3,-1],[1,-3],[4,-2],[2,-4],[5,-3],[3,-5],[4,-4],[2,-1],[1,-2],[3,0],[0,-3],[4,-1],[1,-4],[5,-2],[2,-5],[6,-3],[3,-6],[5,-4],[4,-5]] , [[4,0],[3,0],[3,1],[3,-1],[4,1],[4,-1],[5,1],[5,-1],[5,0],[2,0],[2,1],[2,-1],[2,2],[2,-2],[3,2],[3,-2],[4,2],[4,-2],[5,2],[5,-2],[6,2],[6,-2],[6,1],[6,-1],[6,0]] , [[3,3],[2,3],[3,2],[3,4],[4,3],[2,2],[1,3],[3,1],[2,4],[4,2],[3,5],[5,3],[4,4],[1,2],[2,1],[0,3],[3,0],[1,4],[4,1],[2,5],[5,2],[3,6],[6,3],[4,5],[5,4]] );
	}
}

automacro warpCall {
	console /\(From: (.*)\) : open warp portal/i
	exclusive 1
	call {
		if (@eval (defined $::overallAuth{"$.lastMatch1"} ? $::overallAuth{"$.lastMatch1"}:"None") != 1) stop
		if (@invamount (Blue Gemstone) > 0) goto blue
		do pm "$.lastMatch1" I need a Blue Gemstone.
		stop
	:blue
		do eval undef $::Macro::Data::varStack{loc};my $_l = $::char->{look}{body};return if (!defined $_l);my $_skip = 1;my @_area = @{$_areas[$_l]};foreach my $_z (@_area) {my ($_x, $_y) = ($::char->{pos}{x} + $_z->[0], $::char->{pos}{y} + $_z->[1]);next if (!$::field->isWalkable($_x, $_y));$_skip = 0;foreach my $_npc (@{$::npcsList->getItems()}) {next if ($_npc->{pos_to}{x} != $_x || $_npc->{pos_to}{y} != $_y);$_skip = 1;last;} next if ($_skip);foreach my $_pl (@{$::playersList->getItems()}) {next if ($_pl->{pos_to}{x} != $_x || $_pl->{pos_to}{y} != $_y);$_skip = 1;last;} next if ($_skip);$::Macro::Data::varStack{loc} = $_x ." ". $_y;last} if ($_skip) {$::Macro::Data::varStack{loc} = "none";}

		if ($loc = "") goto look
		if ("$loc" == "none") goto noSkill

		do sl 27 $loc
		pause 2
		call warpList
		do pm "$.lastMatch1" where to?
		stop
	:look
		do look @rand (0,7)
		goto blue
	:noSkill
		do pm "$.lastMatch1" I don't have place for the skill.
	}
}
This time I changed it so when the look variable is not defined the bot will do random look and try again. I did again the tables, but now I don't feel too confident so I'd love if someone checked it for me too, even being so much numbers it's not too difficult because they usually go in pairs ([-1,2] and [1,2], for example)... I'll test it and go to eat.

Re: Warp Portal macro

Posted: 10 Apr 2009, 07:50
by Darki
Okay, it casts the skill still in weird places... I'm going to suicide already. Can you check the look chart for me? Because this is really annoying. -_- If I made another mistake i'm going to go to elementary school again. :cry:

EDIT: I'm guessing that in some cases it doesn't unclear the loc or the $_y/x, because I tried to cast the skill near a wall, and it casted it in the same spot than in the last try, but when I reloaded, now this time it said it couldn't cast the skill. Maybe that is the problem and we should undef everything, not only the location?
ezza wrote:Negative. $loc is undef everytime the eval starts... while $_x and $_y only avail at the moment of the eval line. There is no way it could be stored for the next eval round bcoz we used my there.
I think THAT'S the real problem. Sometimes it carries the same coords than before. I don't understand what else could be ebcause I've revised it many times now. The only time it failed apart from that was when there was a so big obstacle it blocked the line (Warp Portal can snipe but can't pass through obstacles). If we solve this, the only thing the macro would need is a checkLineSnipable, apart from fixing the variables thing.


[Edited: Ezza]
Be patient... I'm the one that love the happy ending. I'll think of a way ^^

Re: Warp Portal macro

Posted: 10 Apr 2009, 10:58
by Darki
ezza wrote:Negative. $loc is undef everytime the eval starts... while $_x and $_y only avail at the moment of the eval line. There is no way it could be stored for the next eval round bcoz we used my there.
Then, I don't know what can happen. I was at 3 squares from a building and it correctly casted the skill in a square. Then I moved the bot to the wall, and I tried again. The results should be the bot telling me that it wasnt possible to cast it, but it casted the skill in the same place than before. I relogged, reloaded, did "look 3" (I think that was the direction), and in the same spot, in front of a wall, it PM'd me "I don't have place for the skill." (as it should have done before too).

Also, when I make the bot face one of the Einbroch trees, for example, it sometimes cast the skill in a square that is at it's back, more or less far, like if the bot messed up the $_l.
ezza wrote:Okay, I got a story back there when I lead my guild to the glory of defending a castle till the 16th war... later everybody take some pics and post it to the forums (each pc take 1 at the same time) . The funny thing is... I dont know how the pics is all different.. i mean the look of each char. In my pic(taken by my pc), I'm as a leader sit infront of others and facing at them... but other pic(taken by other members) showed that I'm looking at other direction while he staring at my char (vice versa from mine).. I dont know how to describe the situation.. but in the end.. we had to take some more pics that will look really nice showing each chars look in the correct direction. In simple saying, if you think you are facing north ... other person might see you facing east... same like if you check your bot direction/look. Maybe this explained why it cast in the wrong/opposite direction
maybe my "tests" are a little messy, but just tell me what to do and I'll write here the results, the macro works on most of the cases even if it's not in the "correct" place, so we could say this is fro the sake of perfection.

EDIT: (We make too many edits ^^U) For the edit you did to my macro... Are you sure the best way is to log the @_areas array on every in-game? Wouldn't be a waste of effort to make the data when in most of the cases the macro won't be used? I say it because I don't use it as a warp seller (In that case it would surely be easier to put a fix location for the macro), and for example, when the bot goes in and out of a map to restock/respawn when dead or just walking to a location, it's not necesary to have the coordinates... I'd say it'd be better to have them just when the macro works, unless there's another reason for that, of course.
ezza wrote:actually you missunderstood the in_game hook with a never released a locked automacro... it only run-once when you start the OK. After all its not the actual coordinate that we played... the actual coordinate is $_x and $_y (not the @_areas or @_area). The waste of eval effort is to cycle the @_areas everytime the eval starts... I've tested your new @_areas.. it seems perfect (not like what you've claimed)