Page 1 of 1
Switch Channel at the end of Waypoints
Posted: Mon Aug 16, 2010 1:46 pm
by Personalausweis
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"/>
Re: Switch Channel at the end of Waypoints
Posted: Mon Aug 16, 2010 8:19 pm
by romvn
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.
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 17, 2010 1:46 am
by Personalausweis
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
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>
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 17, 2010 6:24 am
by Administrator
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 .. ");");
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 17, 2010 8:47 am
by rock5
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
It's the same as writing
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.
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.
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 17, 2010 9:17 am
by Personalausweis
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
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 17, 2010 12:00 pm
by Personalausweis
Works just perfekt!!!!!!
thank you very much
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 17, 2010 6:59 pm
by hihi
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.
Re: Switch Channel at the end of Waypoints
Posted: Wed Aug 18, 2010 1:37 am
by Personalausweis
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.
Re: Switch Channel at the end of Waypoints
Posted: Wed Aug 18, 2010 10:52 pm
by hihi
After reading it again I understand. It just adds to the last waypoint in your waypoint file. Thanks
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 31, 2010 2:51 pm
by fred55555
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
Re: Switch Channel at the end of Waypoints
Posted: Tue Aug 31, 2010 3:14 pm
by nokirk
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);
Re: Switch Channel at the end of Waypoints
Posted: Thu Sep 02, 2010 1:41 am
by Strange_d
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);
Re: Switch Channel at the end of Waypoints
Posted: Thu Sep 02, 2010 8:52 pm
by Strange_d
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);
Re: Switch Channel at the end of Waypoints
Posted: Fri Sep 03, 2010 1:08 pm
by fred55555
thank you very much for sharing