Waypoint injection
-
- Posts: 33
- Joined: Fri Jan 22, 2010 1:23 am
Waypoint injection
This was in the getpos error thread but it don't really belong there so I'm reposting it here. Will add posts with content in a minute (forgot to copy the post before making this).
-
- Posts: 33
- Joined: Fri Jan 22, 2010 1:23 am
Re: Waypoint injection
So far we had:
Jiggaboo wrote:This might actually be useful. If I find the time I'll look into implementing this, shouldn't be too difficult.InadequateCoder wrote:I get the same error and I was wondering if this option existed. Could we make an injections script within the createpath.lua script that added a waypoint after a designated waypoint (this would also autocorrect the comment numbering).
option 7 (or next up I forget what it is), edit existing file
enter filename
mark waypoint
which waypoint would you like to place this waypoint after?
use code to insert
correct comments
have beer and pretzels
watch bot work
etc...
-
- Posts: 33
- Joined: Fri Jan 22, 2010 1:23 am
Re: Waypoint injection
But I just realized that pseudo code was not in order or wouldn't form to what's already there.
When the createpath.lua file is loaded there would be a new option to insert a waypoint.
When the option is used it should check clostest waypoint and echo it saying it's the nearest waypoint as a suggestion (to make the process go smoother).
The next step would be asking which waypoint you want this one to be injected after (if you already knew which one you'd be able input here) --Note: I considered the option of putting before or after but most ppl can do the math of -1 in their head so after alone is good enough.
Here's the part that makes me want to have this added as a modifier key instead of an extra option. What kind of waypoint? Harvest, combat, travel, run, bathroom, snacks, etc... If we make it where the injection is done with CTRL in combination with the numpad key we can remove this step which I'd prefer cause the idea of this function is to reduce the work needed to insert additional waypoints into an existing script.
Thank you for your time
When the createpath.lua file is loaded there would be a new option to insert a waypoint.
When the option is used it should check clostest waypoint and echo it saying it's the nearest waypoint as a suggestion (to make the process go smoother).
The next step would be asking which waypoint you want this one to be injected after (if you already knew which one you'd be able input here) --Note: I considered the option of putting before or after but most ppl can do the math of -1 in their head so after alone is good enough.
Here's the part that makes me want to have this added as a modifier key instead of an extra option. What kind of waypoint? Harvest, combat, travel, run, bathroom, snacks, etc... If we make it where the injection is done with CTRL in combination with the numpad key we can remove this step which I'd prefer cause the idea of this function is to reduce the work needed to insert additional waypoints into an existing script.
Thank you for your time
-
- Posts: 33
- Joined: Fri Jan 22, 2010 1:23 am
Re: Waypoint injection
OK, so more thought into this and the best place for an injection script like this would be during the actual botting process (why can't I think this far ahead, lol).
So, during the end key pause would be the best place for injection.
Something like um, "(Insert) add waypoints to script".
I'll look into how this can be done. If I could wrap my head around all the code in the files I would make it open to the ordinary createpath.lua with the command like it would send:
createpath.lua <current_script_name> -- this would open the createpath script in insertion mode while the bot is paused. This would utilize the existing code and some additional functions added to the pathing script.
ToDo:
Add option to pausing line of bot: (Insert) add waypoints to script (sends the loaded waypoint filename as a switch for createpath.lua)
Add switch to createpath.lua:
dunno how to do that in lua
Add function to echo previous waypoints and upcoming waypoints:
Add function to inject into loaded waypoint list and modify comments accordingly
Modify closing function of createpath.lua to check if the switch is null before asking for a filename.
Moretocome ^^
So, during the end key pause would be the best place for injection.
Something like um, "(Insert) add waypoints to script".
I'll look into how this can be done. If I could wrap my head around all the code in the files I would make it open to the ordinary createpath.lua with the command like it would send:
createpath.lua <current_script_name> -- this would open the createpath script in insertion mode while the bot is paused. This would utilize the existing code and some additional functions added to the pathing script.
ToDo:
Add option to pausing line of bot: (Insert) add waypoints to script (sends the loaded waypoint filename as a switch for createpath.lua)
Add switch to createpath.lua:

Add function to echo previous waypoints and upcoming waypoints:

Add function to inject into loaded waypoint list and modify comments accordingly
Modify closing function of createpath.lua to check if the switch is null before asking for a filename.
Moretocome ^^
- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Waypoint injection
Can you clarify on this part? It sounds like you're saying that using CTRL+NUMPAD_X should insert a waypoint to whichever waypoint list was loaded?InadequateCoder wrote: Here's the part that makes me want to have this added as a modifier key instead of an extra option. What kind of waypoint? Harvest, combat, travel, run, bathroom, snacks, etc... If we make it where the injection is done with CTRL in combination with the numpad key we can remove this step which I'd prefer cause the idea of this function is to reduce the work needed to insert additional waypoints into an existing script.
-
- Posts: 33
- Joined: Fri Jan 22, 2010 1:23 am
Re: Waypoint injection
Administrator wrote:Can you clarify on this part? It sounds like you're saying that using CTRL+NUMPAD_X should insert a waypoint to whichever waypoint list was loaded?InadequateCoder wrote: Here's the part that makes me want to have this added as a modifier key instead of an extra option. What kind of waypoint? Harvest, combat, travel, run, bathroom, snacks, etc... If we make it where the injection is done with CTRL in combination with the numpad key we can remove this step which I'd prefer cause the idea of this function is to reduce the work needed to insert additional waypoints into an existing script.
Actually with the evolution of the idea with my next post this becomes unecessary but I'll gladly explain what I meant here. CTRL+NUMPAD_1 = Normal Waypoint, CTRL_NUMPAD_2 = Harvest Waypoint, and so on..
As I thought about it, the best place to add these extra waypoints is while the bot is running (thus my last post before this one).
Sorry for any confusion and thanks for looking at this again

-
- Posts: 33
- Joined: Fri Jan 22, 2010 1:23 am
Re: Waypoint injection
After some research I've learned where in bot.lua I want the injection script added but by what I read at lua.org it probly isn't possible.
Based on what I read it's a command that is strictly controlled by micromacro.exe and can't be modified in the script. I wanted to add another option there that would have an insertion option.
Like so:
I'll keep researching but if there is a way to do this please let me know. So far I haven't found anything suggesting this is can be modified.
Thank you for your time.
Code: Select all
coroutine.yield();
Like so:
Code: Select all
Paused. (Delete) to continue,(Insert) to add waypoints, (CTRL+L) exit to shell,
(CTRL+C) quit
Thank you for your time.

- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Waypoint injection
You cannot modify coroutine.yield(). It is a standard Lua function. Instead, just add code to the main loop or wherever else you need to do whatever it is you're trying to do.
-
- Posts: 33
- Joined: Fri Jan 22, 2010 1:23 am
Re: Waypoint injection
Ok, I think I've come up with a workaround but it's not going to be as pretty as my last idea
.
A new argument for bot.lua that would activate an atPause(); function called modwp. When prompted for a script you would type rom\bot.lua modwp.
First we add the add the argument.
I'm not sure this is written properly or if what I've suggested is even possible so any slap backs or improvements/corrections are welcome.
Thanks again for looking at it (this is of course still incomplete)
Edit: So far I got everything but the load by include statement to work. I've decided to encapsulate the code in the createpath.lua file into a function and name it modiypath.lua so I can include it with the other lua files and call it in the function instead. Still working on modifying the modifypath.lua file to accept a filename as an argument then load the data as an existing waypoint list.
I'm falling asleep so I'm gonna have to work on this later. Good night

A new argument for bot.lua that would activate an atPause(); function called modwp. When prompted for a script you would type rom\bot.lua modwp.
First we add the add the argument.
Code: Select all
--add the local call outside the main function
local WPModActive = false
for i = 2,#args do
if( args[i] == "update" ) then
include("update.lua");
end
-- add the argument check in the main function
if( args[i] == "modwp" ) then
print("Loaded with waypoint modification at pause (End)");
WPModActive = true
end
local foundpos = string.find(args[i], ":", 1, true);
if( foundpos ) then
local var = string.sub(args[i], 1, foundpos-1);
local val = string.sub(args[i], foundpos+1);
if( var == "profile" ) then
forcedProfile = val;
elseif( var == "path" ) then
forcedPath = val;
elseif( var == "retpath" ) then
forcedRetPath = val;
else
-- invalid option
local msg = sprintf(language[61], args[i]);
error(msg, 0 );
end
end
-- check the options
if(not foundpos and args[i] ~= "update" ) then
local msg = sprintf(language[61], args[i]);
error(msg, 0 );
end;
end
--add the atPause function at the end of the file, probably needs to be before the startMacro statement
function pause_callback()
if (WPModActive == true) then
print("Loading createpath.lua in modify mode.");
local cpNameStr = sprintf("createpath.lua ", __WPL:getFileName());
include(cpNameStr);
end
atPause( pause_callback() );
Thanks again for looking at it (this is of course still incomplete)

Edit: So far I got everything but the load by include statement to work. I've decided to encapsulate the code in the createpath.lua file into a function and name it modiypath.lua so I can include it with the other lua files and call it in the function instead. Still working on modifying the modifypath.lua file to accept a filename as an argument then load the data as an existing waypoint list.
I'm falling asleep so I'm gonna have to work on this later. Good night

Who is online
Users browsing this forum: Bing [Bot] and 2 guests