Switch Channel at the end of Waypoints

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Personalausweis
Posts: 73
Joined: Mon Aug 16, 2010 12:50 pm

Switch Channel at the end of Waypoints

#1 Post by Personalausweis » Mon Aug 16, 2010 1:46 pm

Hi there,

to make my bot more "undetectable" i would like to add a channel-switch at the end of the waypoints.
I searched the forum for "switch Channel" and found some code:

Code: Select all

sendMacro("ChangeParallelID(2);");
   player:rest(25);  
cause this is the first time i took a deeper look into LUA coding (have some experience with delphi many years ago ;) )and the rom-bot itself, I need some help of you guys. :)

is it possible to insert this code into my waypoints like this:

Code: Select all

if "current channel" = 1 
 then "switch to channel 2"
  elseif "current channel" = 2
   then "switch to channel 3"
    elseif "current channel" = 3
     then "switch to channel 4"
      elseif "current channel" = 4
       then "switch to channel 1"
      end
     end
    end
 end


and another question what is "modifier" for?

Code: Select all

<skill name="PRIEST_RISING_TIDE"	[b]modifier=""[/b] hotkey="VK_3" priority="90"/>

romvn
Posts: 16
Joined: Tue May 04, 2010 10:22 pm

Re: Switch Channel at the end of Waypoints

#2 Post by romvn » Mon Aug 16, 2010 8:19 pm

To switch Channels, you can use

Code: Select all

repeat parallelID = RoMScript("GetCurrentParallelID()"); yrest(500) until parallelID
if (parallelID < 4) then
	sendMacro("ChangeParallelID(parallelID+1);");
else
	sendMacro("ChangeParallelID(1);");
end
player:rest(25); 
This page is useful, go for it http://www.theromwiki.com/List_of_Functions

Modifier seems to be Ctrl, Alt and Shift keys.
Proud to be the GREATEST botter in Chúa Tể Phục Sinh (RoM Vietnamese version)

Personalausweis
Posts: 73
Joined: Mon Aug 16, 2010 12:50 pm

Re: Switch Channel at the end of Waypoints

#3 Post by Personalausweis » Tue Aug 17, 2010 1:46 am

The first line with "repeat parallelID ..." does this save the "elseif" part from my example?!
it seems to set a variable to the current channel but what does it repeat until what?
and why wait 500 seconds?!
what does the part in the brackets after the if mean

Code: Select all

(parallelID < 4)
many questions i know, but i hate c&p cause i want to understand and learn what i'm doing. :)

so can i put this code like this into the waypoint?!

Code: Select all

<!-- # 1 --><waypoint x="-1820" z="-10323">
repeat parallelID = RoMScript("GetCurrentParallelID()"); yrest(500) until parallelID
if (parallelID < 4) then
   sendMacro("ChangeParallelID(parallelID+1);");
else
   sendMacro("ChangeParallelID(1);");
end
player:rest(25); 
</waypoint>
 <!-- # 2 --><waypoint x="-1955" z="-10397">
</waypoint>

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Switch Channel at the end of Waypoints

#4 Post by Administrator » Tue Aug 17, 2010 6:24 am

First thing you're going to have a problem with is this line:
sendMacro("ChangeParallelID(parallelID+1);");
parallelID isn't known within the game's scope, so you need resolve it before passing the date:
sendMacro("ChangeParallelID(" .. parallelID+1 .. ");");

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Switch Channel at the end of Waypoints

#5 Post by rock5 » Tue Aug 17, 2010 8:47 am

Personalausweis wrote:The first line with "repeat parallelID ..." does this save the "elseif" part from my example?!
it seems to set a variable to the current channel but what does it repeat until what?
and why wait 500 seconds?!
Unfotunately RoMScript sometimes returns nil when it shouldn't. Most of the time the repeat will only happen once but if RoMScript returns nil, it will repeat. So the repeat is just a way to make sure it doesn't return nil.

The 500 ms pause is just to put a pause between attempts. It could probably be a lot shorter, say 50 ms, or removed altogether although I do know that if too many calls to RoMScript happen in too short a time it can crash the script. Although in this case that probably wouldn't happen.
Personalausweis wrote:what does the part in the brackets after the if mean

Code: Select all

(parallelID < 4)
It's the same as writing

Code: Select all

(parallelID < 4)
but this way will cause errors in xml files. I personally find it easier to just flip it around to avoid the error, like this.

Code: Select all

(4 > parallelID)
This won't cause the error.
Personalausweis wrote:so can i put this code like this into the waypoint?!

Code: Select all

<!-- # 1 --><waypoint x="-1820" z="-10323">
repeat parallelID = RoMScript("GetCurrentParallelID()"); yrest(500) until parallelID
if (parallelID < 4) then
   sendMacro("ChangeParallelID(parallelID+1);");
else
   sendMacro("ChangeParallelID(1);");
end
player:rest(25); 
</waypoint>
 <!-- # 2 --><waypoint x="-1955" z="-10397">
</waypoint>
Yes, as long as you make the change Administrator said.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Personalausweis
Posts: 73
Joined: Mon Aug 16, 2010 12:50 pm

Re: Switch Channel at the end of Waypoints

#6 Post by Personalausweis » Tue Aug 17, 2010 9:17 am

ah ok so yrest() is milliseconds an player:rest() is seconds!?


thanks a lot you two
i'll give it a try this evenening and post my results here.

hope this will make the bot more like a common player, cause in the past i realized that a 30 minute farm-route isn't enough to make others believe that it isn't a bot :)
now i can try it with a 60 minute route and changing channels to avoid unnecessary whispers ;)

Personalausweis
Posts: 73
Joined: Mon Aug 16, 2010 12:50 pm

Re: Switch Channel at the end of Waypoints

#7 Post by Personalausweis » Tue Aug 17, 2010 12:00 pm

Works just perfekt!!!!!!


thank you very much :)

hihi
Posts: 16
Joined: Fri Aug 13, 2010 12:45 pm

Re: Switch Channel at the end of Waypoints

#8 Post by hihi » Tue Aug 17, 2010 6:59 pm

Personalausweis wrote:Works just perfekt!!!!!!


thank you very much :)
I was just coming here to look for something like this. Now if you could be so kind to maybe make a small guide on the steps to accomplish this for people like me who dont know how to code it would be great :) I get a little lost on where to place all the code in the back and forth posts.

Thanks.

Personalausweis
Posts: 73
Joined: Mon Aug 16, 2010 12:50 pm

Re: Switch Channel at the end of Waypoints

#9 Post by Personalausweis » Wed Aug 18, 2010 1:37 am

hihi wrote:
Personalausweis wrote:Works just perfekt!!!!!!


thank you very much :)
I was just coming here to look for something like this. Now if you could be so kind to maybe make a small guide on the steps to accomplish this for people like me who dont know how to code it would be great :) I get a little lost on where to place all the code in the back and forth posts.

Thanks.

do exactly what stands above.

hihi
Posts: 16
Joined: Fri Aug 13, 2010 12:45 pm

Re: Switch Channel at the end of Waypoints

#10 Post by hihi » Wed Aug 18, 2010 10:52 pm

After reading it again I understand. It just adds to the last waypoint in your waypoint file. Thanks :)

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: Switch Channel at the end of Waypoints

#11 Post by fred55555 » Tue Aug 31, 2010 2:51 pm

so can yu cut and paste your final version of the switching script that goes before the last line of the waypopint file please
or is it just the ".. .." that is added

still kinda confused

thnx

nokirk
Posts: 73
Joined: Sat Jul 03, 2010 2:26 pm

Re: Switch Channel at the end of Waypoints

#12 Post by nokirk » Tue Aug 31, 2010 3:14 pm

copy&paste version:

Code: Select all

		repeat parallelID = RoMScript("GetCurrentParallelID()"); yrest(500) until parallelID
			if (4 > parallelID) then
			sendMacro("ChangeParallelID(" .. parallelID+1 .. ");");
		else
		   sendMacro("ChangeParallelID(1);");
		end
		player:rest(25);

Strange_d
Posts: 9
Joined: Mon Aug 30, 2010 3:43 pm

Re: Switch Channel at the end of Waypoints

#13 Post by Strange_d » Thu Sep 02, 2010 1:41 am

Would this work ok?

Code: Select all

if( player.Fights-player.free_counter1 > 200 ) then
	repeat parallelID = RoMScript("GetCurrentParallelID()"); yrest(500) until parallelID
		if (4 > parallelID) then
		sendMacro("ChangeParallelID(" .. parallelID+1 .. ");");
	else
		sendMacro("ChangeParallelID(1);");
end
player:rest(25); 

Strange_d
Posts: 9
Joined: Mon Aug 30, 2010 3:43 pm

Re: Switch Channel at the end of Waypoints

#14 Post by Strange_d » Thu Sep 02, 2010 8:52 pm

Taking another look at the wiki example I need the 'player.free_counter1 = player.Fights' line to reset the counter correct?

So it should be this or do I need something after the counter reset to start the repeat?

Code: Select all

if( player.Fights-player.free_counter1 > 200 ) then
   player.free_counter1 = player.Fights;
   repeat parallelID = RoMScript("GetCurrentParallelID()"); yrest(500) until parallelID
      if (4 > parallelID) then
      sendMacro("ChangeParallelID(" .. parallelID+1 .. ");");
   else
      sendMacro("ChangeParallelID(1);");
end
player:rest(25); 
This would work as well in a more basic functionality? Only swaps you between 1 and 2. Drop it best in the repair.xml file in a waypoint next to your repair npc?

Code: Select all

if( player.Fights-player.free_counter1 > 200 ) then
   player.free_counter1 = player.Fights;
   sendMacro(ChangeParallelID(3-GetCurrentParallelID()));
end
player:rest(25);

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: Switch Channel at the end of Waypoints

#15 Post by fred55555 » Fri Sep 03, 2010 1:08 pm

thank you very much for sharing

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 13 guests