Help with script needed here..

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Tyrismido
Posts: 14
Joined: Wed Oct 28, 2009 9:08 pm

Help with script needed here..

#1 Post by Tyrismido » Fri Oct 30, 2009 3:01 am

Hello...
I have been trying to make my bot load a certian path after certian amount of time..but it always failed not sure why..
here is the code

Code: Select all

<!-- #16 --><waypoint x="-12364" z="10939">
if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
	if( os.difftime(os.time(), player.free_counter1) > 3 )	
		player.free_counter1 = player.BotStartTime_nr;
		loadPaths("repair_1");
	end
</waypoint>
shouldnt it load "repair_1" after 3 secs of fighting?
I hope I am doing something wrong..

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Help with script needed here..

#2 Post by d003232 » Fri Oct 30, 2009 4:09 am

Try:

Code: Select all

	<!-- #16 --><waypoint x="-12364" z="10939">
	if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
	if( os.difftime(os.time(), player.free_counter1) > 3600 )	
		player.free_counter1 = os.time();
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>
If it's not working, just add your own 'printf' commands to set the content of your fields:

Code: Select all

	<!-- #16 --><waypoint x="-12364" z="10939">
	if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
printf("counter: %s\n", player.free_counter1);
printf("diff: %s\n", os.difftime(os.time(), player.free_counter1));
	if( os.difftime(os.time(), player.free_counter1) > 3600 )	
		player.free_counter1 = os.time();
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>
And you need to come 2x to that waypoint to have loaded the new path. Because at the first time you reach that wp the difference would be 0.
The RoM Bot Online Wiki needs your help!

Tyrismido
Posts: 14
Joined: Wed Oct 28, 2009 9:08 pm

Re: Help with script needed here..

#3 Post by Tyrismido » Fri Oct 30, 2009 5:54 am

thanks for help but wat is that printif used for ? I dont really know @.@
and 1 more thing please..how do I make the bot say something ?
like it to say "/script UseACtion(11);" so that it mount up.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Help with script needed here..

#4 Post by d003232 » Fri Oct 30, 2009 7:15 am

Tyrismido wrote:thanks for help but wat is that printif used for ? I dont really know @.@
and 1 more thing please..how do I make the bot say something ?
like it to say "/script UseACtion(11);" so that it mount up.
With the 'printf' you will see the content of the fields in your MM window. So you can see if everything is right. Use

Code: Select all

sendMacro()
to use the RoM API functions. I would recommend to take a look into the RoM Bot Wiki -> Functions.
The RoM Bot Online Wiki needs your help!

Tyrismido
Posts: 14
Joined: Wed Oct 28, 2009 9:08 pm

Re: Help with script needed here..

#5 Post by Tyrismido » Fri Oct 30, 2009 11:33 am

thanks so much

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: Help with script needed here..

#6 Post by j_schlott » Fri Oct 30, 2009 11:57 am

RoMScript("UseAction(11);")
sendMacro("UseAction(11);")
or
keyboardPress(key.VK_MINUS);

inside a waypoint tag should use your horse, dont forget to add a wait for the spell cast or you will run off without mounting

Tyrismido
Posts: 14
Joined: Wed Oct 28, 2009 9:08 pm

Re: Help with script needed here..

#7 Post by Tyrismido » Fri Oct 30, 2009 8:07 pm

oh thanks alot guys...
I have another problem ..
when I am stuck it usualy try 10 times to get out then log out..
wat if I want it to load a path after the 10 tries?
also wat if I have an addon for combat and I want it to take care of the combat...wat should I do ? just delete the class skills from my profile?
because I tried that and the bot kept just luring mobs and run to another..

User avatar
droppen
Posts: 179
Joined: Mon Aug 03, 2009 10:32 pm

Re: Help with script needed here..

#8 Post by droppen » Sat Oct 31, 2009 12:20 am

Tyrismido wrote:oh thanks alot guys...
I have another problem ..
when I am stuck it usualy try 10 times to get out then log out..
wat if I want it to load a path after the 10 tries?
also wat if I have an addon for combat and I want it to take care of the combat...wat should I do ? just delete the class skills from my profile?
because I tried that and the bot kept just luring mobs and run to another..
you should try learning lua

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Help with script needed here..

#9 Post by d003232 » Sat Oct 31, 2009 1:10 am

Tyrismido wrote: also wat if I have an addon for combat and I want it to take care of the combat...wat should I do ? just delete the class skills from my profile?
because I tried that and the bot kept just luring mobs and run to another..
Create your own skill. And look at the wiki how to deactivate targting / movement functionality.
The RoM Bot Online Wiki needs your help!

hamncheese
Posts: 9
Joined: Tue Oct 27, 2009 9:13 pm

Re: Help with script needed here..

#10 Post by hamncheese » Sun Nov 01, 2009 3:51 pm

d003232 wrote:Try:

Code: Select all

	<!-- #16 --><waypoint x="-12364" z="10939">
	if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
	if( os.difftime(os.time(), player.free_counter1) > 3600 )	
		player.free_counter1 = os.time();
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>
If it's not working, just add your own 'printf' commands to set the content of your fields:

Code: Select all

	<!-- #16 --><waypoint x="-12364" z="10939">
	if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
printf("counter: %s\n", player.free_counter1);
printf("diff: %s\n", os.difftime(os.time(), player.free_counter1));
	if( os.difftime(os.time(), player.free_counter1) > 3600 )	
		player.free_counter1 = os.time();
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>
And you need to come 2x to that waypoint to have loaded the new path. Because at the first time you reach that wp the difference would be 0.
need some guidance on repair with time, i tried to use this code :

Code: Select all

<waypoints>
	<!-- #  1 --><waypoint x="360" z="8870">
if( os.difftime(os.time(), player.BotStartTime) > 3660 ) then
	yrest(5000);
      	keyboardPress(key.VK_9);
	player.BotStartTime = 0; 
      	yrest(20000);
	loadPaths("Repair 17-18 Silverspring 38,23.xml");
</waypoint>
problem while using the code above : the timer wont reset, so after the bot press key 9 (recall button) and load the repair path, and back to grinding path, after the bot arrive on waypoint 1 (inside grinding path) , the timer is more than 3660 (1 hour and 1 minute) so the bot tried to use the recall button, which is on cooldown, so it run straight line to waypoint 2 to on my repair path which is quite far away from the original grinding spot
question : is there any other way/code to reset the timer ?

tried to use another code like the sample above, and inserting the recall code

Code: Select all

<waypoints>
	<!-- #  1 --><waypoint x="360" z="8870">
		if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
		if( os.difftime(os.time(), player.free_counter1) > 10 )	
		player.free_counter1 = os.time();
		yrest(5000);
      		keyboardPress(key.VK_9);
		player.BotStartTime = 0; 
      		yrest(20000);
		load_paths("Repair 17-18 Silverspring 38,23.xml");
	end
	
		</waypoint>
problem while using the code above :
Image

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Help with script needed here..

#11 Post by d003232 » Sun Nov 01, 2009 3:55 pm

Code: Select all

if( os.difftime(os.time(), player.free_counter1) > 10 )   
THEN at the end of the line is missing.

And

Code: Select all

player.free_counter1 = os.time();
that's the 'reset' of the timer.
The RoM Bot Online Wiki needs your help!

hamncheese
Posts: 9
Joined: Tue Oct 27, 2009 9:13 pm

Re: Help with script needed here..

#12 Post by hamncheese » Sun Nov 01, 2009 11:33 pm

woot thank you so much d003232, the code works flawlessly and a note to others, the "reset timer" for the code above does not actually put the timer back to 0 on your micromacro window, so if your timer is set on 3660 (61 minute) the timer showed on the micromacro window will keep on increasing.
hope this clear some confusion like i had :)

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Help with script needed here..

#13 Post by d003232 » Mon Nov 02, 2009 2:20 am

hamncheese wrote:woot thank you so much d003232, the code works flawlessly and a note to others, the "reset timer" for the code above does not actually put the timer back to 0 on your micromacro window, so if your timer is set on 3660 (61 minute) the timer showed on the micromacro window will keep on increasing.
hope this clear some confusion like i had :)
You are right. It set's the time to the acutal time and we allways count the difference between the actual time and the last timer value (last time we go to repair).
The RoM Bot Online Wiki needs your help!

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 8 guests