Warp Portal ultimate macro! REVISED

Moderator: Moderators

Message
Author
Darki
Been there done that!
Been there done that!
Posts: 143
Joined: 25 Oct 2008, 08:14
Noob?: No
Location: Spain, Madrid
Contact:

Re: Warp Portal macro

#51 Post by Darki »

(We need to start writting our posts properly, thanks you're a mod and you won't ban me for repeating posts. xD)

That in your story is something that can happen perfectly, like when you're running from a geo and it attacks you from 6 squares away due to the lag, for example. But in this case I bet it's more of a field problem, because if the problem was the lag, it would turn back and cast the skill randomly sometimes, but it has happened ONLY in special casses. All I can say is that the current code is just done, and if there's a problem in it's performance it's not due to it, but to the Kore/RO internals and there's very little we could do then.

EDIT: I've managed to get the damn snipable check, so, finally, I'll post the last and working version for the macro. :3

Actually I was thinking that maybe the check for snipable line is not useful at all, and instead of that we should use the checkLineWalkable. Because in some cases, the bot may end casting the skill at the other side of a cliff... o.o Didn't happen to me but I just though about it... xD

EDIT 2: Fix'd.
ImageImageImage
ImageImageImage
ImageImageImage

Apple kore
Noob
Noob
Posts: 4
Joined: 19 Sep 2009, 22:01
Noob?: No
Location: Inside an apple seed covering.

Re: Warp Portal ultimate macro!

#52 Post by Apple kore »

Wow this is an awesome idea!

You guys are working so hard on it. I decided to test it out. I don't quite understand what you mean by Ezza's mod. I checked out the link you gave me but it was alittle complex and it only listed examples.

When I pm my priest "open warp portal" it triggers the automated warp but it wont pm me Where to or give me a warp list. Is there any specifications that need to be met? I already added my character name to the Overallauth.txt
Image

Darki
Been there done that!
Been there done that!
Posts: 143
Joined: 25 Oct 2008, 08:14
Noob?: No
Location: Spain, Madrid
Contact:

Re: Warp Portal ultimate macro!

#53 Post by Darki »

Wow it has been ages (actually, 2 years) since I last tried this set of macros...

I'm really very happy because it still works at least for me. I'm going to be a bit more active this summer to update it, so I guess if there's any problem I can solve. For now I've noticed that the guy gets stucked after casting and I don't know what to do, lol, but I'll get to it. It has been so long that I don't remember anything. x_x

So, I would like to update this because I've noticed that, while the macro seems to work more or less well, probably it's a bit outdated, and it could be adapted to new perl subroutines and stuff. I have no idea of this yet, so first I gotta learn some perl.
ImageImageImage
ImageImageImage
ImageImageImage

kaikai
Noob
Noob
Posts: 6
Joined: 07 Apr 2009, 08:14
Noob?: Yes

Re: Warp Portal ultimate macro!

#54 Post by kaikai »

it really is old I'll try it and give it a thought ;) ... I never thought that I would search OK forums again (keep deleting my RO but still keep DLing it :lol: )

Darki
Been there done that!
Been there done that!
Posts: 143
Joined: 25 Oct 2008, 08:14
Noob?: No
Location: Spain, Madrid
Contact:

Re: Warp Portal ultimate macro!

#55 Post by Darki »

I've updated the macro but I'm currently testing it, so if you wait a bit I'll post it when I have time. I simplified it a lot. :)
ImageImageImage
ImageImageImage
ImageImageImage

kaikai
Noob
Noob
Posts: 6
Joined: 07 Apr 2009, 08:14
Noob?: Yes

Re: Warp Portal ultimate macro!

#56 Post by kaikai »

sure, I can wait :D

hranica
Noob
Noob
Posts: 1
Joined: 13 Sep 2012, 08:18
Noob?: No

Re: Warp Portal ultimate macro! REVISED

#57 Post by hranica »

tested this one and it works well.

but i need help with something i want to add.
here's a rundown:

2 bots (warper and master)
master will pm warper the commands (open warp and memo selection)
warper will move master to opened warp OR master will move to opened warp

sadly im noob to code writing.
if anyone can point out possible syntaxes for what i'm trying to accomplish i could start writing it myself.

Thank You!

flashdbest
Plain Yogurt
Plain Yogurt
Posts: 61
Joined: 12 Nov 2012, 09:22
Noob?: Yes

Re: Warp Portal ultimate macro! REVISED

#58 Post by flashdbest »

Hi, Edited your code so that users won't have to edit the macro itself.

It will only accept commands from it's master (what ever value found in followTarget)

Commands :
open warp --> bot will cast warp portal and give you the list of available warps
warp #1-4 --> will open warp to selected map

Code: Select all


sub warpPosition {
   my ($_px, $_py) = @_;
   my $_l = $::char->{look}{body};
   if (!defined $_l || $_l > 7) {$_l = int(rand(8))};
   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) = ($_px + $_z->[0], $_py + $_z->[1]);
      next if (!$::field->isWalkable($_x, $_y));
      next if (!Misc::checkLineWalkable({x => $_px, y => $_py},{x => $_x, y => $_y}, 0));
      $_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 == 1);
      foreach my $_pl (@{$::playersList->getItems()}) {
         next if ($_pl->{pos_to}{x} != $_x || $_pl->{pos_to}{y} != $_y);
         $_skip = 1;
         last;
      }
      next if ($_skip == 1);
      foreach my $_mon (@{$::monstersList->getItems()}) {
         next if ($_mon->{pos_to}{x} != $_x || $_mon->{pos_to}{y} != $_y);
         $_skip = 1;
         last;
      }
      next if ($_skip == 1);
      return $_x." ".$_y;
   }
   return "none";
}

automacro warpPortal {
   pm "open warp"
   overrideAI 1
   exclusive 0
   call {
    $masterName = @eval($::config{followTarget})
    if ($masterName == $.lastpm) goto Checkblue
      goto ending
      :Checkblue
      if (@invamount (Blue Gemstone) > 0) goto blue
      do pm "$.lastpm" I need a Blue Gemstone.
      stop
   :blue
      do ai manual
      $px = @arg("$.pos", 1)
      $py = @arg("$.pos", 2)
      $loc = warpPosition($px, $py)
      if ("$loc" == "none") goto noSkill
      do sl 27 $loc
      lock all; pause 2
      if (@eval (if (!$::char->{warp}{memo}[0]) {return 0}) == 0) goto fail
      release useWarp
      do pm "$.lastpm" Those are my current saved maps:
         $i = 0
         while ($i <= 3) as warpLoop
         do pm "$.lastpm" @eval ($i + 1) : @eval ($::char->{warp}{memo}[$i])
         $i++
      end warpLoop
      do pm "$.lastpm" where to?
      pause 10
      do pm "$.lastpm" I guess you changed your mind...
      do warp cancel
      goto ending
   :fail
      do pm "$.lastpm" Sorry, I couldn't cast the skill.
   :ending
      log ending
      set exclusive 1; release all; lock useWarp; do ai on
      stop
   :noSkill
      do pm "$.lastpm" I don't have place for the skill.
      do ai on
   }
}

automacro useWarp {
   pm /warp (1|2|3|4|close)/
   overrideAI 1
   exclusive 1
   call {
      $masterName = @eval($::config{followTarget})
      if (($masterName ==  $.lastpm) && (($.lastMatch1 == "1") || ($.lastMatch1 == "2") || ($.lastMatch1 == "3") || ($.lastMatch1 == "4"))) goto continue
      do warp cancel
      goto ending
:continue
   if ($.lastMatch1 == "close") goto cancel
      do eval my %_warp = ("1", "0", "2", "1", "3", "2", "4", "3");$::Macro::Data::varStack{dest} = $_warp{$::Macro::Data::varStack{".lastMatch1"}}
      do warp $dest
      do pm "$.lastpm" Warp opened! Destination: @eval ($::maps_lut{$::char->{warp}{memo}[$dest].'.rsw'})!
      goto ending
   :cancel
      do pm "$.lastpm" I guess you changed your mind...
      do warp cancel   
   :ending
      release all;lock useWarp; do ai on
    }
}


gelo2012
Plain Yogurt
Plain Yogurt
Posts: 58
Joined: 17 Sep 2012, 13:54
Noob?: Yes
Location: Sa Puso Mo

Re: Warp Portal ultimate macro! REVISED

#59 Post by gelo2012 »

I get this error when I pm my slave with "open warp"
[macro] warpPortal.call error: error in 11: Unrecognized --> warpPosition <--
Sub-Routine
I did:
copy-paste the sub routine chunk in a text document and saved it as warpPosition.pl
then copy-paste the macro chunk in my macros.txt
did I miss something?

gelo2012
Plain Yogurt
Plain Yogurt
Posts: 58
Joined: 17 Sep 2012, 13:54
Noob?: Yes
Location: Sa Puso Mo

Re: Warp Portal ultimate macro! REVISED

#60 Post by gelo2012 »

Because no one replied :(
..and I can't make the *routine chunk* to work, I did this instead:

Code: Select all

automacro warpPortal {
	pm "warp open"
	overrideAI 1
	exclusive 0
	call {

	$nick = $.lastpm
	$master = @eval (defined $::overallAuth{"$nick"} ? $::overallAuth{"$nick"}:"None")
	if ($master == 1) goto blueCheck
	pause @rand(2, 3, 4, 5, 6)
	$num = @rand(1, 3)
	if ($num == 1) goto pm
	if ($num == 2) goto pub
	if ($num == 3) goto emo
	stop
	:pm
	   do pm "$.lastpm" @random ("?","hahaha","hu u?","nga-nga","bakit koia?","saya mo","wahaha")
	   log [Warp Portal] Unauthorized player: $nick
	   stop
	:pub
	   do c @random ("bakit?","nyahaha","hu u?","ha?","bakit koia?","saya mo","anak ng")
	   log [Warp Portal] Unauthorized player: $nick
	   stop
	:emo
	   do e @random ("gg","an","ag","wah",",","heh","hmm","pea","pif")
	   log [Warp Portal] Unauthorized player: $nick
	   stop

		:blueCheck
		   if (@invamount (Blue Gemstone) < 10) goto blueLow
		   goto warpOpen

			:blueLow
			   if (@invamount (Blue Gemstone) == 0) goto blueNone
			   $blueAmount = @invamount(Blue Gemstone)
			   do g I'm running low on Blue Gemstone: @invamount(Blue Gemstone) pcs left.
			   goto warpOpen
			:blueNone
			   do g I need a Blue Gemstone.
			   stop

		:warpOpen
		   do ai manual
		   $px = @arg("$.pos", 1)
		   $py = @arg("$.pos", 2)
		   $loc = warpPosition($px, $py)
		   if ("$loc" == "none") goto noSkill
		   do sl 27 $loc
		   lock all; pause 2
		   if (@eval (if (!$::char->{warp}{memo}[0]) {return 0}) == 0) goto fail
		   release useWarp
		   do pm "$.lastpm" Saved Map(s):
		   $i = 0
		   while ($i <= 3) as warpLoop
		   do pm "$.lastpm" @eval ($i + 1) : @eval ($::char->{warp}{memo}[$i])
		   $i++
		   end warpLoop
		   do pm "$.lastpm" Usage: warp [1-4]
		   pause 10
		   do pm "$.lastpm" I guess you changed your mind...
		   do warp cancel
		   goto ending

		:fail
		   do g Sorry, I couldn't cast the skill.
		   do ai on
		   stop

		:noSkill
		   do g I don't have place for the skill.
		   do ai on
		   stop

		:ending
		   log Ending WarpPortal...
		   set exclusive 1; release all; lock useWarp; do ai on
		   stop

	}
}


###################### Start Warp #####################

automacro useWarp {
	pm /warp (1|2|3|4|close)/
	overrideAI 1
	exclusive 1
	call {
	$nick = $.lastpm
	$master = @eval (defined $::overallAuth{"$nick"} ? $::overallAuth{"$nick"}:"None")
	if ($master == 0) goto notMaster
	goto masterG

	:masterG
	   if (($master == 1) && (($.lastMatch1 == "1") || ($.lastMatch1 == "2") || ($.lastMatch1 == "3") || ($.lastMatch1 == "4") || ($.lastMatch1 == "list") || ($.lastMatch1 == "close"))) goto continue
	   do warp cancel
	   goto ending

	:notMaster
	   pause @rand(2, 3, 4, 5, 6)
	   do pm "$.lastpm" @random ("?","UNGAS","baliw","asa","batukan kya kita?","hahaha","hu u?","pwet ka","asa pa","sige umasa ka","nga-nga")
	   log [Warp Portal] Unauthorized player: $nick
	   stop

	:continue
	   if ($.lastMatch1 == "close") goto cancel
	   do eval my %_warp = ("1", "0", "2", "1", "3", "2", "4", "3");$::Macro::Data::varStack{dest} = $_warp{$::Macro::Data::varStack{".lastMatch1"}}
	   do warp $dest
	   do c @eval ($::maps_lut{$::char->{warp}{memo}[$dest].'.rsw'})!
	   pause 8
	   $px = @arg("$.pos", 1)
	   $py = @arg("$.pos", 2)
	   $loc = warpPosition($px, $py)
#Remove this to warp-move	   do move $loc
	   goto ending

	:cancel
	   do g Warp portal closed.
	   do warp cancel

	:ending
	   release all;lock useWarp; do ai on
	}
}
Note:
I am terribly sorry, but I think I might have missed something. It's all functioning well now. :oops:
The slave also enters the warp portal 5 seconds after it has been opened. So just put "#" in the beginning
of the highlighted code if you want to make it stay like a good dog.
Also, if the player is not authorized, slave pauses @random 2-6 seconds then will randomly use: pm, public message or emoticons (set in the code)
The slave will inform you if he/she is running low on Blue Gemstone.

I intentionally put the auto reply for intruders so that if you are in the middle of using your slave's warp,
it will just reply a set of message to him/her. :lol:

I took some of the macro codes here: Auto reply collection with emoticons/chat macro [pRO] for the overallAuth thingy to work. :D

Post Reply