Page 3 of 7

Re: Warp Portal macro

Posted: 06 Apr 2009, 20:37
by ezza
how thick is the wall? Maybe the coordinate drop at the other side of the wall (6 blocks is already a big gap)... or maybe you missplaced the @area coordinates.


p.s: I've made some changes in my last post.

Re: Warp Portal macro

Posted: 07 Apr 2009, 02:57
by Darki
The "wall" was a building with area enough to cover all the screen xD (Clock Tower), so I'm sure that wasn't the problem, there wasn't any open spot near the sight. And yes, maybe I missplaced the coordinates, but in case I added a check in, let see, the other axis of the radius the bot would just turn and cast the skill, the only error I could have is in the +/- signs because all numbers were between 6 and -6... I'll check then with your numbers till I make the macro work then, and I'll do well the table.

For your changes I'll test right when I have time, thanks Ezza. :3

Re: Warp Portal macro

Posted: 07 Apr 2009, 04:03
by ezza
Darki wrote:For your changes I'll test right when I have time, thanks Ezza. :3

The changes is compulsary. Some of the previous codes were wrong, thats why the result is wierd. As for the coordinates tables... sit calm and write it slowly.. dont make any mistake (i've found mistakes in your tables) :)

Re: Warp Portal macro

Posted: 07 Apr 2009, 06:00
by Darki
Actually I was guessing, instead the largue "if" thing, if this would also work:

Code: Select all

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 $_l = $::char->{look}{body} - 0;
  my @area = @{$areas[$_l]}; 
  foreach my $_z (@area) {
#...
}
It'd avoid all the first if statement. What do you think? I was reading some spanish forum and found something similar so I though it'd work.

P.s: For the tables, I did it while talking to my girlfriend but I didn't thing I was so unconcentrated. xD

Re: Warp Portal macro

Posted: 07 Apr 2009, 11:59
by ezza
yes.. absolutely can also. 5 + 5 = 10 and 5 x 2 = 10 ... in spite of the fact that the answer is same... we have variety of ways to get it.

But I strongly advise that the @areas array should be loaded for 1 time at the in_game hook. Let OK remember it on every 1st login. So that your macro will be much shorter and tidy. I guess its all cleared now. You happy me happy... everybody happy... one happy family!



p.s: Just dont make any mistake when you wrap it ^^

Re: Warp Portal macro

Posted: 07 Apr 2009, 18:06
by Darki
EDIT: Okay, now I'm starting to get angry... -_- Aparrt that I ordered wrong the sides (don't ask, just that I did wrong xD), after I fixed that, now when it has no room it still gets a spot. In this case, it gets the character's original position, and I don't know why this happens, when there are no coordinates for [0,0]... ._. I tested 3 or 4 times but it had the same problem. I didn't test it more things like just middle obstacles, I tried to make it react when there aren't places and that's what happens... :/

I can put an if statement in the macro to take away that when the position is the same than the character, but I'd really love to know why is this happening. :/ I'll do more tries in the test server tomorrow, but this is annoying. :|

Re: Warp Portal macro

Posted: 07 Apr 2009, 21:33
by ezza
Darki wrote:...but I'd really love to know why is this happening...

Mind to show us the foreach block?



p.s: When is the happy time?

Re: Warp Portal macro

Posted: 08 Apr 2009, 09:49
by Darki
The foreach block is the same you wrote, unless I did any mistake putting it in one line. The only change was that I did the array the way I posted lately, could that be a problem?


EDIT: Here's the macro:

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 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 $_l = $::char->{look}{body} - 0;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}if ($_skip) {$::Macro::Data::varStack{loc} = "none";}


		if ("$loc" == "none") goto noskill
		do sl 27 $loc
		pause 2
		call warpList
		do pm "$.lastMatch1" where to?
		stop
	:noskill
		do pm "$.lastMatch1" I don't have place for the portal...
	}
}
		
	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
		]
	}
You can just use the eval and the skill without the list macro to test if you want, is what I did.

Re: Warp Portal macro

Posted: 08 Apr 2009, 21:24
by ezza

Code: Select all

macro eval2 {
    do eval undef $::Macro::Data::varStack{loc};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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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";}

    log $loc
}
Note:
1. The above codes works only if you have a look direction... there are some cases that we dont have look direction ex: when we 1st login, when changing map, respawn and etc.
2. Becareful of any obstacle/s ... you might failed trying to cast a warp to the other side of an obstacle that is parallel to you since your range coordinate becomes wider.



p.s: You just lack some experience... thats all I could say ^^ Sometimes the codes worked in a normal plugins but not in the macro eval. So, playing alot with it will make you to become a sifu maybe.. So... can I have my happy time now? :lol:

Re: Warp Portal macro

Posted: 09 Apr 2009, 01:51
by Darki
You can have your happy time whenever you want, sorry being a bother with this shit... :oops:

About the obstacle, I know it might fail when trying to do after a "ground obstacle" (I think Warp Portal can't "snipe"), but as I said I tried with a "full obstacle" that took all the area away, and in that case it were taking the "zero point" where the character is standing. There's no check for the [0,0] so I don't understand how would it check it, that's all. xD

(I was guessing that, even choosing that spot, wouldn't the macro recognize you as a "player" and discard that place too? maybe the problem was just after the check, I dunno.

For the non snipable think the only solution would be a checkLineSnipable" or something, but that's adding more shit. xD

P.s: I tested your code but it still cast the portal on other weird places like in the same spot than the character or at it's back... -_- Maybe the problem is the big array and we should go back with the if thing, I dunno. Anyways I'll be good boy and stfu for some days even if there's any problem, I need a break. Here's the happy time. xD My only guess is that it's weird that the LONG macro I did works better than the eval, even being slower. :|