Page 2 of 2

Re: Enhanced Functionality!

Posted: Fri Dec 03, 2010 6:48 am
by rock5
Just checked. Looks like it is in fact a function, list_waypoint_files(). Just have to see if I understand how to add an option to the paused state.

Re: Enhanced Functionality!

Posted: Fri Dec 03, 2010 8:48 am
by jduartedj
rock5 wrote:

Code: Select all

Paused. (DEL) to continue, (CTRL+L) exit to shell, (CTRL+C) quit (CTRL+W) load new waypoint file

Exactly THAT's What I meant! and where I was saying interrupt i meant like you do with pause! So yes, BINGO!

Re: Enhanced Functionality!

Posted: Fri Dec 03, 2010 6:19 pm
by rock5
jduartedj wrote:
rock5 wrote:

Code: Select all

Paused. (DEL) to continue, (CTRL+L) exit to shell, (CTRL+C) quit (CTRL+W) load new waypoint file

Exactly THAT's What I meant! and where I was saying interrupt i meant like you do with pause! So yes, BINGO!
I've added it to my todo list but I'll have to ask Administrator about how to add a key to the list as I don't quite follow it. :)

Re: Enhanced Functionality!

Posted: Fri Dec 03, 2010 7:05 pm
by jduartedj
rock5 wrote:
jduartedj wrote:
rock5 wrote:

Code: Select all

Paused. (DEL) to continue, (CTRL+L) exit to shell, (CTRL+C) quit (CTRL+W) load new waypoint file

Exactly THAT's What I meant! and where I was saying interrupt i meant like you do with pause! So yes, BINGO!
I've added it to my todo list but I'll have to ask Administrator about how to add a key to the list as I don't quite follow it. :)

I'm pretty sure I've seen a function that does this... it captures the keys if they are CTRL+L etc... not sure where ... if in bot or MM.

Re: Enhanced Functionality!

Posted: Fri Dec 03, 2010 8:01 pm
by Administrator
It is currently hard-coded into lib.lua. I'll work on modifying the code to allow scripts to dynamically insert global hotkeys.

Re: Enhanced Functionality!

Posted: Fri Dec 03, 2010 8:07 pm
by jduartedj
Here Rock5 it must be something like this:

at the end function pauseCallback use:

Code: Select all

while(true) do
   yrest(10);
   if( keyPressed(key.VK_CONTROL) and keyPressed(key.VK_W) ) then
        (code to go back)
   end
end
this is what MM uses for keytesting/pausing.... and pauseCallback is the function that is called (on rom-bot) on pause so....

I havent tested it anyway, I'm just hinting a shot at this.

(Could this work?)

Re: Enhanced Functionality!

Posted: Fri Dec 03, 2010 8:22 pm
by jduartedj
jduartedj wrote:

Code: Select all

while(true) do
   yrest(10);
   if( keyPressed(key.VK_CONTROL) and keyPressed(key.VK_W) ) then
        (code to go back)
   end
end
OOPSS this disables PAUSE (CTRL+L) need to break it or maybe call [EDIT:]exit on CTRL+L
EDIT2: FIXED but resume isn't working either .... - this does it as CTRL+C doesn't need to be specified

Code: Select all

	while(true) do
		yrest(10);
		if( keyPressed(key.VK_CONTROL) and keyPressed(key.VK_W) ) then
			printf("Code to execute\n");
		end
		if( keyPressed(key.VK_CONTROL) and keyPressed(key.VK_L) ) then
			exitCallback();
			break;
		end

	end
I have realised this works fully with:

Code: Select all

		if( keyPressed(settings.hotkeys.START_BOT.key) ) then --Settings is Is always loaded here
			printf("Press DEL again.\n");
			break;
		end
include but this is not supposed to be here at all :S
Basically I'm doing MM's work for it! this evaluation is supposed to be done in MM like Admin said.
Also this code requires pressing DEL twice and only works after the settings are loaded (which makes sense btw).
This code is very sloppy because it generates useless trash (duplicates) and I can't bypass that....

Re: Enhanced Functionality!

Posted: Sat Dec 04, 2010 12:18 am
by rock5
This is getting over the head for me but I'm sure Administrator will work it out.

Re: Enhanced Functionality!

Posted: Sat Dec 04, 2010 3:30 pm
by jduartedj
After a way-too-big amount of effort I was able to workaround and do sucessfully make the bot return to the waypoint list and start another waypoint file.

But like admin said this change has to be done at MM level.
This workaround is very sloppy and messy.

first I used:

Code: Select all

	while(true) do
		yrest(10);
		if( keyPressed(key.VK_CONTROL) and keyPressed(key.VK_W)) then
			printf("Press DEL twice, flag set to %s\n", player.free_flag1);
			player.free_flag1 = true
			return;
		end
		if( keyPressed(key.VK_CONTROL) and keyPressed(key.VK_L)) then
			exitCallback();
			return;
		end
		if( keyPressed(settings.hotkeys.START_BOT.key) ) then
			printf("Press DEL again.\n");
			return;
		end
	end
at the end on function pauseCallback() in functions.lua file

then I had to put this:

Code: Select all

		if player.free_flag1  == true then  --my code
			__WPL=nil;
			printf("Restarting... %s\n", player.free_flag1);
			player.free_flag1 = false;
			return botting(); --tail call
		end
at the beggining of

Code: Select all

while(true) do
in the bot.lua file

and finally add:

Code: Select all

function botting()
after

Code: Select all

		-- end of local function list_waypoint_files()
and put:

Code: Select all

end --end of botting
botting();
at the end of main().

Works but not so great... so I DON''T advise ppl to use it!

Re: Enhanced Functionality!

Posted: Sat Dec 04, 2010 4:03 pm
by jduartedj
2 - Include the Waypoint path file in the title bar!
By including this:

Code: Select all

		if (__WPL) then --test if not nil use "and option==true" to set it optional
			if (__WPL.FileName) then --test if not nil either in case of wander
				waypoint = "<"..__WPL.FileName.."> ";
			end
		end
on function timedSetWindowName(profile) of functions.lua inside the Existing IF, adding

Code: Select all

local waypoint=" "
before such IF and replacing displayname argument of sprintf for waypoint..displayname I get the name of the waypoint file on the title bar. My suggestion is to make this optional but I don't know whats the take on this matter by Admin or any RoM Bot developer.

EDIT:
use this instead it's better, but if you use wander then it'll show <<NONE>>:

Code: Select all

		if (__WPL) then --not nil use "and option =true" to set it optional
				waypoint = "<"..__WPL:getFileName().."> ";
		end