MM (bot) starting RoM client and attaching automatically?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

MM (bot) starting RoM client and attaching automatically?

#1 Post by Jandrana » Thu Aug 30, 2012 7:26 am

Currently you need the RoM client being running when you start the bot script.

Is it possible that the bot script will start the RoM client and does an "auto login" (using fast login) and starts a script, without any user intervention?

What I'd like to do is create several shortcuts (batch files) on my desktop.
1st short cut -> start client #1 -> doing elfdailys for all chars configured by the script
2nd short cut -> start client #2 -> doing mini-games for all chars configured by the script
...

Current maybe this "could" work, if only one client is active. But if a 2nd client is active and you start the bot, it asks which client to attach.
If the bot would start the client itself, it could retrieve it's process handle and no further asking would be required.

If this would be possible you could start a client at a certain time using "at" and doing your scripts (maybe early in the morning, after the dailies and mini-games have been reset). Maybe this way the bot could also detect when RoM has crashed and automatically restart it, so the scripts could continue (if they are written smart).

Anybody tried this? Is it possible with the current implementation of MM?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: MM (bot) starting RoM client and attaching automatically

#2 Post by lisa » Thu Aug 30, 2012 7:46 am

Jandrana wrote:Current maybe this "could" work, if only one client is active. But if a 2nd client is active and you start the bot, it asks which client to attach.
use "character"
example

Code: Select all

rom/bot path:blahblah profile:him character:him
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

dx876234
Posts: 188
Joined: Sat Jul 24, 2010 6:13 am

Re: MM (bot) starting RoM client and attaching automatically

#3 Post by dx876234 » Fri Aug 31, 2012 5:37 am

I'm doing something of what your asking, I made a startup micromacro/lua script which based on userfunction_LoginNextChar logs a startup character, then based on micromacro starts the script where the startuptoon is 1st character in charlist.
  • Starts a client with os.execute([[START /D"]]..d_RoM..[[" Client NoCheckVersion]])
  • Starts the micromacro with os.execute([[START /D"]]..getPath()..[[" micromacro scripts/rom/bot.lua character:]]..fastLoginChrName.." "..opts)
  • Resize/move the windows out of the way based on userfunction_mmext
  • Keeps track of chrashed clients and kills/restarts them
-dx

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

Re: MM (bot) starting RoM client and attaching automatically

#4 Post by rock5 » Fri Aug 31, 2012 3:23 pm

There would be a lot of people who would love you for it. But how would you make it log in? You could theoretically use mouse clicks to click the corresponding button for the account to log into, and click the character and "Enter world", but you would need to know what screen you are at. While finding the new "isInGame" memory address, I also found an address for if it is at the character selection screen. I didn't need it for my last commit but it's currently 0x9FBa50. So that's all you would need to know what screen you are at.
  • 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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: MM (bot) starting RoM client and attaching automatically

#5 Post by Jandrana » Fri Aug 31, 2012 6:34 pm

I played around a bit trying to start the client without getting into the launcher.

Runewalker did a bit of voodoo stuff. The client refuses to care about the option "NoCheckVersion", if the parent process is not the "explorer" or the launcher. At least it looks this way.

If you hit "Start -> Run" and enter:

Code: Select all

"C:\Program Files\Runes of Magic\client.exe" NoCheckVersion
the client skips the launcher and presents the login screen.

If you enter the same from a command window, the client.exe starts the launcher.exe and terminates itself. Maybe this should be some kind of "bot protection", to make it harder to get a process handle to the client process using the CreateProcess API.

I wrote a small program that starts the client using the ShellExecute API, which skips the launcher. So you can start RoM from a batch file.

Regarding the auto login, I found this in the autologin.lua:

-- >>>>>>>>>>>>>>>>>>>> CHOOSE WHETHER TO AUTO LOGIN OR NOT <<<<<<<<<<<<<<<<<<<<<
fastLoginAutoLogin = false
-- >>>>>>>>>>>>>>> ENTER YOUR USERNAME BETWEEN THE QUOTES BELOW <<<<<<<<<<<<<<<<<
fastLoginUser = ""
-- >>>>>>>>>>>>>>> ENTER YOUR PASSWORD BETWEEN THE QUOTES BELOW <<<<<<<<<<<<<<<<<
local fastLoginPass = ""

If I fill in the appropiate field, I can auto start RoM and get into the char selection screen. It should be not so hard to auto select a char now.

B.t.w - if I start the rom bot in this state, this error happens:
Loading profile abc.xml
Did not find any crashed game clients.
1:17am - E:/Games/micromacro/scripts/rom/macros.lua:322: attempt to compare nil
with number

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

Re: MM (bot) starting RoM client and attaching automatically

#6 Post by rock5 » Sat Sep 01, 2012 12:42 am

The problem with those options is how would you log into the game for manual play? It would automatically log into that account.

I'm not sure what the error is as it looks like you don't have the current version of the bot but it looks like it has something to do with the getHotKey functions. That probably has something to do with setupMacros. Maybe you are trying to start the bot proper before the game is ready. Do you check if the game has fully started before starting the bot?

I noticed the issue with NoCheckVersion when trying to start the client at the end of my models changing batch files. That's why there is no client start. It would be good if we could find a way to start the client with the option because then we wouldn't have to deal with the clientupdate.exe process. Also, even though we might be able to click the clientupdate start button, it has this strange feature that sometimes it doesn't log in and you have to move the mouse a bit and click again. It would be better if we didn't have to deal with that.
  • 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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: MM (bot) starting RoM client and attaching automatically

#7 Post by Jandrana » Sat Sep 01, 2012 6:20 am

The problem with those options is how would you log into the game for manual play? It would automatically log into that account.
There are solutions for this:
- keep an extra copy of the RoM directory for this purpose
- a starter prog could change the "fastLoginAutoLogin" variable.

No beautiful solutions, but this could work.
I'm not sure what the error is as it looks like you don't have the current version of the bot but it looks like it has something to do with the getHotKey functions. That probably has something to do with setupMacros. Maybe you are trying to start the bot proper before the game is ready. Do you check if the game has fully started before starting the bot?
No, I should be up to date with 739. I'm still launching RoM and rom bot manually and I'm doing some testing, if things work. I started the bot while RoM displayed the character selection screen. I thought this could be a state where the bot could start, but it seems this is not possible.

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

Re: MM (bot) starting RoM client and attaching automatically

#8 Post by rock5 » Sat Sep 01, 2012 6:42 am

Jandrana wrote:a starter prog could change the "fastLoginAutoLogin" variable.
Not really. The only way to change them would be to edit the files before starting the game. You can't change the variable in game because you don't have the games lua environment available to the bot until the game has fully started. The only things you can do at the login and character selection screens is read memory and keypresses and possibly mouse clicks, no lua code.
Jandrana wrote:No, I should be up to date with 739.
Sorry I think I was looking at an older version of the bot. Looking at it again I see line 322 now makes sense. Previous comments still apply.
Jandrana wrote:I started the bot while RoM displayed the character selection screen. I thought this could be a state where the bot could start, but it seems this is not possible.
Basically the bot needs to be able to execute lua code in game. It uses the macros. Macros aren't available until the game has fully started. So any solution to log in would have to fully start the game before starting the bot proper.
  • 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

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: MM (bot) starting RoM client and attaching automatically

#9 Post by lisa » Sat Sep 01, 2012 8:22 am

At best you could login to 1 acc/char and then start running scripts to change chars, as Rock said though even when you play manually it will still autologin to that acc/char.
So if you make an account you will never play and have that as the default login acc you could do it but you would have to start the clients with a delay so they don't try to log that same account at the same time.

Apart from that I don't see it working, unless you have a different client for each bot you run at the same time.

I guess it is possible to alter the login file before the client is started, could cause issues with already running clients though.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: MM (bot) starting RoM client and attaching automatically

#10 Post by lisa » Sat Sep 01, 2012 8:29 am

So in a nutshell

1.
Have the same number of clients as bots you want to run at the same time, if you have the hard drive space it is prbably a good option.

2.
Alter the login file before starting the client, may cause issues with already running clients

3.
Have an account purely for starting up the clients and then relog straight away, need to stager the client starting so they arn't trying to log same acc at same time.

ALL of these choices still have 1 major flaw, you need to start with NoVersionCheck, even with more folders with the client it will still kill another client unless you have the NoVersionCheck.

Might be a dumb question but did anyone try using 2 lots of quote thingies in their code??

Code: Select all

'"C:\Program Files\Runes of Magic\Client.exe" NoCheckVersion'
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: MM (bot) starting RoM client and attaching automatically

#11 Post by rock5 » Sat Sep 01, 2012 9:30 am

Can't get it to work with "NoCheckVersion" but I got it working like this

Create a shortcut in the games directory. I've just called it "client".
Add the NoCheckVersion option to it.
Then the following command will work, assuming same directory location. Of course the shortcut could be anywhere.

Code: Select all

os.execute('START "" /B "C:\\Games\\Runes of Magic\\client.LNK"')
  • 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

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: MM (bot) starting RoM client and attaching automatically

#12 Post by lisa » Sat Sep 01, 2012 11:23 am

rock5 wrote:Create a shortcut in the games directory. I've just called it "client".
smart thinking =)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

dx876234
Posts: 188
Joined: Sat Jul 24, 2010 6:13 am

Re: MM (bot) starting RoM client and attaching automatically

#13 Post by dx876234 » Sun Sep 02, 2012 6:17 am

I've setup with two client instances installed, one for interactive playing with all addons and stuff, the other for botting with Rocks texture removal and minimum addons, this also have the autolog setup to log through a machine specific autolog character.

All waypoints uses the autolog character as 1st character in charlist, tests for this and logs next char if its the autolog character.

Usage of the autolog character is protected by a spinlock based on a mkdir on cach/lockdir as this is an atomic operation in windows.

I use a script as described above to start all bots/clients using these mechanisms. The result is that I have a desktop link starting any bot and I can schedule execution.

-dx

Note, below is not fully working code, implementation is heavily based on my customized environment, I am currently moving to a database environment to make the mechanisms working on multi machine setups

Link content starting a bot script:

Code: Select all

C:\Users\xxx\Desktop\micromacro\micromacro.exe scripts/rom/Multibot paralell:2 profile:tiering character:testtoon
Main part of my Multibot:

Code: Select all

--[[
	Main control of tiering bot system
--]]
require "ex"

include("userfunctions/userfunction_autolog.lua")

function main()
	local stream, opts = getArgs(args)
	
	-- Clean out old locks
	autoUnlock()
	
	-- Start the paralell streams
	if( stream ) then
		if( stream > 0 ) then
			for i=1,stream do
				startStream(i, opts)
			end
		else
			startStream(math.abs(stream), opts)
		end

	else
		startStream(1, opts)
	end
		
	-- Keep watch for the RoM client Crash window
	-- and terminate when detected XXX: print date/time
	repeat
		local win = findWindow("Crash Report", "#32770")
		if( win > 0 ) then
			printf("Found window [%s/%s]\n", getWindowName(win), getWindowClassName(win))
			local pid = findProcessByWindow(win)
			os.execute("TASKKILL /PID " .. pid .. " /F")
		end
		yrest(secondsToTimer(5))
	until false
end

startMacro(main,true)
Relevant part of the userfunction_autolog:

Code: Select all

require "lfs"
require "ex"

--
-- Get the lock for exclusive access to autolog character
--
function autoLock()
	local lname = autolog_lock_path()
	local lock 

	repeat
		lock = lfs.mkdir(lname)
		if( not lock) then
			cprintf(cli.red, "Waiting 20s for autolog lock\n");
			yrest(secondsToTimer(20))
		end
	until lock 
end

-- Release the lock
function autoUnlock()
	lfs.rmdir(autolog_lock_path())
end

function startStream(n, opts)
	autoLock()
	
	-- Start execution through autolog character
	ex.setenv("MMPROC", tostring(n)) -- multi bot support, put in separate chans
	os.execute([[START /D"]]..d_RoM..[[" Client NoCheckVersion]])
	
	showWait(90)
	os.execute([[START /D"]]..getPath()..[[" micromacro scripts/rom/bot.lua character:]]..fastLoginChrName.." "..opts)
	showWait(60)

	autoUnlock()
end

-- Error handling, XXX: windowValid not consistent, check window class as well?
-- Hook in with atError
function autologErrorCallback(script, line, message)
	yrest(secondsToTimer(30))
	if( not windowValid(getAttachedHwnd()) ) then		
		local paralell, opts = getArgs(args)
		printf("No client attached, restarting client!\n")
		startStream(procNumber, opts)
		os.exit()
	end
end

japanac
Posts: 16
Joined: Thu Aug 30, 2012 6:54 am

Re: MM (bot) starting RoM client and attaching automatically

#14 Post by japanac » Sat Sep 08, 2012 3:12 pm

I don't wanna make new tread, because i think i will ask stupid question.
i wanna make .bat file for starting bot(path and char), so i edit start.bat in bot folder

Original:
@echo off
FOR /F "tokens=1 delims=" %%A in ('cd') do SET folder=%%A
START ../../micromacro.exe "%folder%/bot.lua"

My:
@echo off
FOR /F "tokens=1 delims=" %%A in ('cd') do SET folder=%%A
START ../../micromacro.exe "%folder%/bot.lua path:ks character:mychar"

But something is wrong. in mm window i have massage:
10:5pm - cannot open C:\Program Files (x86)\Runes of Magic\micromacro\scripts\ro
m/bot.lua path:ks character:mychar: Invalid argument

When try manual rom\bot path:ks character:mychar everything is ok.

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

Re: MM (bot) starting RoM client and attaching automatically

#15 Post by rock5 » Sat Sep 08, 2012 3:29 pm

Try

Code: Select all

START ../../micromacro.exe "%folder%/bot.lua" path:ks character:mychar
  • 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

japanac
Posts: 16
Joined: Thu Aug 30, 2012 6:54 am

Re: MM (bot) starting RoM client and attaching automatically

#16 Post by japanac » Sat Sep 08, 2012 4:27 pm

Rock you rock.
Btw i use little program to record mouse movement, clicks and keybord input, to start and close client (and mm) at desire time. "Remouse"- trial - (40 bucks full) didn't find crack and now serching for some free alternative.

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

Re: MM (bot) starting RoM client and attaching automatically

#17 Post by rock5 » Sat Sep 08, 2012 4:36 pm

What's that popular one everyone uses? Autoit, I think it's called.
  • 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

User avatar
Edamh
Posts: 106
Joined: Tue May 24, 2011 11:56 pm

Re: MM (bot) starting RoM client and attaching automatically

#18 Post by Edamh » Thu Oct 25, 2012 9:34 am

Using this post to setup UAC permissions and this current topic, I'm trying to setup one batch file to load and attach MM instances to (manually loaded) RoM instances.

Here's what I'm using.

Code: Select all

@echo off
FOR /F "tokens=1 delims=" %%A in ('cd') do SET folder=%%A
START D:/micromacro/micromacro.exe "D:/micromacro/scripts/rom/bot.lua" path:MyTestWaypointFile character:Alpha
START D:/micromacro/micromacro.exe "D:/micromacro/scripts/rom/bot.lua" path:MyTestWaypointFile character:Beta
START D:/micromacro/micromacro.exe "D:/micromacro/scripts/rom/bot.lua" path:MyTestWaypointFile character:Gamma
START D:/micromacro/micromacro.exe "D:/micromacro/scripts/rom/bot.lua" path:MyTestWaypointFile character:Delta
START D:/micromacro/micromacro.exe "D:/micromacro/scripts/rom/bot.lua" path:MyTestWaypointFile character:Epsilon
START D:/micromacro/micromacro.exe "D:/micromacro/scripts/rom/bot.lua" path:MyTestWaypointFile character:Zeta
The batch file loads the 6 instances of MM, but it still prompts me to select which character to go with each MM instance. Once I select the character and press the DELETE key, the MM instance loads the selected waypoint file correctly.
What am I missing something from my batch file for the batch file to select the character automatically and then press the DELETE key to continue? Thanks.

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: MM (bot) starting RoM client and attaching automatically

#19 Post by noobbotter » Thu Oct 25, 2012 10:35 am

I think in the command line between the rom/bot and the path option you can use profile:profilename to specify the profile/character to use. Not sure if that would do it or not but worth a try.

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

Re: MM (bot) starting RoM client and attaching automatically

#20 Post by rock5 » Thu Oct 25, 2012 12:25 pm

I just tried the following and it worked for me.

Code: Select all

@echo off
FOR /F "tokens=1 delims=" %%A in ('cd') do SET folder=%%A
START ../../micromacro.exe "%folder%/bot.lua" path:rbassist character:alpha
START ../../micromacro.exe "%folder%/bot.lua" path:rbassist character:beta
START ../../micromacro.exe "%folder%/bot.lua" path:rbassist character:gamma
I can't see how the way you did it differently wouldn't work. Are you sure the character names are spelt correctly? Did you try with fewer at a time? Maybe it can't handle too many at once.
  • 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

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 5 guests