Automatic 'login' script

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Post Reply
Message
Author
turbobay
Posts: 44
Joined: Wed Jul 31, 2013 7:20 pm

Re: Automatic 'login' script

#81 Post by turbobay » Sat Aug 24, 2013 9:39 am

This is a really nice feature. I tried it just today and it works fine, BUT i have one issue...

the .bat-file starts micromacro, but i am always urged to confirm execution, i never bothered when starting it manually, i even don't reember it anymore.
but as i want to try out some time schedule it would be necessary that MM starts without confirmation dialog needed. I searched a bit on google, but in Win7 it seems to be a bit tricky to avoid this confirm dialog. Is there any "easy" way to get rid of this confirmation ?

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

Re: Automatic 'login' script

#82 Post by rock5 » Sat Aug 24, 2013 10:02 am

What does the message say exactly?
  • 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
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Automatic 'login' script

#83 Post by BlubBlab » Sat Aug 24, 2013 12:56 pm

For me it sounds like the scheduler needs admin right himself to start MM with admin rights, other solutions may found here http://windows.microsoft.com/de-de/wind ... nt-control

But I have a question too^^ I read something about restarting a crashed client, I don't remember where and I don't know if it already exist(I doubt it) but I think I have may a solution(I m not finished).

First I found this from you :

Code: Select all

while(true) do
		if isClientCrashed() then
 			error("Client crash detected in main bot loop.")
		 end
change to this:

Code: Select all


    local function checkclient()
		local crashflag =	isClientCrashed();
		if crashflag then
			 RestartChar()-- function
			loadPaths(__WPL.FileName);
 			
		 end
    end
   registerTimer("ClientDetection", secondsToTimer(3), checkclient);
	
	while(true) do
Because I couldn't use RestartChar() because the bot get stucks some where deep in the code, but it work only half because the bot continue where he was so when you close the client the bot got an :

Code: Select all

ERFOLGREICH: Der Prozess mit PID 8848 wurde beendet.
6:2am - ...xxxxy/Documents/micromacro2/scripts/rb2/functions.lua:1438: bad ar
gument #1 to 'memoryReadBytePtr' ((null))
So my plan is first check if client crashed without closing it start a new client, start a proxy program which close the old MM-bot and start a new MM-bot with a delay of 5 sec in the meantime I close the crashed client and let the old MM run in its errors.(I know the WP has to been setup so that the bot always can find out what to do next )

Is there a arg for the bot to which rom windows it should attached and I ask myself would it if I only login in a new client and then close the old client not be already enough ?
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

turbobay
Posts: 44
Joined: Wed Jul 31, 2013 7:20 pm

Re: Automatic 'login' script

#84 Post by turbobay » Sat Aug 24, 2013 1:15 pm

The message...in german^^
Möchten Sie zulassen, dass durch das folgende Programm von einem unbekannten Herausgeber Änderungen an diesem Computer vorgenommen werden.

Do you want to allow the following program from unknown ressource to make changes to this computer.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Automatic 'login' script

#85 Post by BlubBlab » Sat Aug 24, 2013 1:42 pm

yes that the Question when you need run something with admin rights, MM needs that so you need run the scheduler with admin right I think. The problem with my idea and your problem is I don't know if the admin rights go to the child process I hope so because under linux it does
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

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

Re: Automatic 'login' script

#86 Post by rock5 » Sat Aug 24, 2013 2:32 pm

To tell you the truth, I'm not an expert on Windows security. It might be UAC security. You should do a search online.
  • 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
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Automatic 'login' script

#87 Post by BlubBlab » Sat Aug 24, 2013 10:15 pm

I searched already the first time i didn't find anything, I tried again now I know it does and I'm ready for testing

Code: Select all

local function checkclient()
		local crashflag, cpid =	isClientCrashed();
		if crashflag then
			
			if cpid and windowValid(cpid) then
				login( getChar(), getAcc(), "Client") --starting a new rom client
				  --arg 1 directory"name/" arg 2 path arg3 profile ar4 character (optional) arg5 retpath
				  -
				 if( __RPL == nil)then
                                        os.execute("START romrestarter.exe "..getExecutionPath().."/ "..__WPL.Name.." "..getChar().." "..getChar()..""); -- start of a new MM thourgh proxy
				else
					os.execute("START romrestarter.exe "..getExecutionPath().."/ "..__WPL.Name.." "..getChar().." "..getChar().." " .. __RPL.Name..""); -- start of a new MM thourgh proxy
				end
				rest(100)
				local pidm = findProcessByWindow(cpid);
				os.execute("TASKKILL /PID " .. pidm .. " /F") -- kill  old client
				repeat 
					rest(500)
				until not windowValid(cpid)
				
 			end
		end
	end
	registerTimer("ClientDetection", secondsToTimer(3), checkclient);
	
	while(true) do
I'm not sure about the directories the proxy program " romrestarter.exe" lies at the same directory in which Micromacro.exe lies I'm always confused about the lua directory system. I have the c# source code added to the post the first test was so LOL->Kill parent process = kill your test environment system and I got shock for a second didn't thought about it at all.
Attachments
restart.txt
(3.64 KiB) Downloaded 185 times
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Automatic 'login' script

#88 Post by BlubBlab » Fri Aug 30, 2013 9:52 am

Okay after some testing and reading the manual I know more especially how coco works.
In short main() running in a coroutine, yrest() and coroutine.yield() will bounce back the resources to coco coroutine management in the layer above, yrest() only for the time in the arg(arg >100), while coroutine.yield() means take how long it ever take but that is not the point.

The point is something like this:

Code: Select all

registerTimer("GMdetection", secondsToTimer(5), GMdetection);
Is simply a coroutine started from the layer above, to more specific it will very likely never run if the bot not reach it bottom in the main while loop.

So I have 3 possible way to do it:
1. Let it be like it is and it will only work in 30-50%
2. Using real threads with Lua Lanes http://kotisivu.dnainternet.net/askok/bin/lanes/
3. Log the information in File like: MM PID, Client PID, ACC, Char, waypoint, return_waypoint(optional) and using a external prog to watch client and MM

to 2. I have already compiled it and done some basic integration with MM but I'm a little confused by its API (flyer like)
a.) The limitation in which the "lanes" have access to the outside memory seems for me not to clear, what are user datas(function stack ,heap, table?) and are lindas(pipes/queue) really the only way or the suggest way to pass information ...etc (problem in short can I access global vars from inside lanes? )
b.)I would love to avoid busy-waiting loops but the timer in the API is mysterious.

Has anyone a suggestion?
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: Automatic 'login' script

#89 Post by lolita » Mon Sep 02, 2013 4:59 am

i noticed if waypoint file name have 2 word's in name and you wana start it from batch file, like this

Code: Select all

FOR /F "tokens=1 delims=" %%A in ('cd') do SET folder=%%A
START ../../micromacro.exe "%folder%/login.lua" acc:2 char:1 client:rom path:Flower Daily
you will get this error

Code: Select all

MicroMacro v1.03
SolarStrike Software
http://www.solarstrike.net
Opening login.lua...
Starting script execution - Press CTRL+C to exit.
Press CTRL+L to cancel execution and load a new script.
-------------------------------------------------------------------------------

    Rock5s 'login' script. Version 3.1

Starting client rom ...
Clicking account 2 ...
Selecting character 1 ...
Waiting until in-game ...
Installing userfunctions. wrong dir

We read the hotkey settings from your bindings.txt file C:\Users\****\My Documents\Runes of Magic\bindings.txt instead of using the settings.xml file.
Welcome to rom bot! press END to quit
RoM Bot Version 3.29, Revision 761
Press the (End) key to stop/pause the script.
You can resume with the (Delete) key.
The game client did not crash.
11:53am - E:\Program Files\micromacro\scripts\rom/login.lua:51: Invalid option 'daily' for bot.lua

Syntax: rom/bot.lua [profile:profname] [path:pathname] [retpath:retname] [charac
ter:charname]

profile:profname        force the use of profile 'profname.xml'
path:pathname           force the use of waypoint file 'pathname.xml'
retpath:retname         force the use of return waypoint file 'retname.xml'
character:charname      force the use of client with 'charname' loaded



AL lib: FreeContext: (01EA0F58) Deleting 1 Source(s)
Please enter the script name to run.
Type in 'exit' (without quotes) to exit.
Script>
Life is a journey, not destination :D

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Automatic 'login' script

#90 Post by BlubBlab » Mon Sep 02, 2013 5:20 am

That is because "Daily"(from: Flower Daily) is the next arg so it won't work.
Flags like path: or char: are for the purpose that you can freely arrange the order of them.(and make some optional and human understandable )

The arg are parted from the OS by " " a space character so you give with " " the next arg, so rename it to Flower_Daily or FlowerDaily
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

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

Re: Automatic 'login' script

#91 Post by rock5 » Mon Sep 02, 2013 5:41 am

Note: that is not a limitation of the 'login' script. It's a bot limitation. You also can't start a waypoint like that using MM in the usual way.

Code: Select all

rom/bot path:flower daily
Wont work. But you can select it from the waypoint list.

But a good rule to follow is don't use spaces in waypoint file names.
  • 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
Bot_romka
Posts: 96
Joined: Tue Apr 05, 2011 2:59 am
Location: Russia

Re: Automatic 'login' script

#92 Post by Bot_romka » Wed Dec 18, 2013 5:44 pm

Code: Select all

	-- Click character until at LoadingScreen
	reserveActiveWindow()
	print("Selecting character "..character.." ... ")
	repeat
		clickCharacter(character) rest(1000)
		keyboardPress(key.VK_ENTER)
		rest(2000)
	until memoryReadBytePtr(getProc(),addresses.loadingScreenPtr, addresses.loadingScreen_offset) ~= 0
	releaseActiveWindow()

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Automatic 'login' script

#93 Post by ZZZZZ » Mon Feb 03, 2014 9:44 am

Code: Select all

    Rock5s 'login' script. Version 3.1

Starting client rom4ubot ...
WARNING: Failure reading memory from 0x28FA60 at 0xa42368 in memoryReadBytePtr()
. Error code 299 (Only part of a ReadProcessMemory or WriteProcessMemory request
 was completed.)
Got this error when trying to launch rom through the patch file. Got to login screen and just kept spaming that.

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

Re: Automatic 'login' script

#94 Post by rock5 » Mon Feb 03, 2014 10:03 am

I'm not 100% sure but I don't think login.lua will run update.lua automatically. 0xa42368 looks like an official client address and it looks like you are trying to login in to rom4u. So try running update.lua first then try again.
  • 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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Automatic 'login' script

#95 Post by ZZZZZ » Mon Feb 03, 2014 10:29 am

Ah i see. I use the 1 MM for official and nexon and at the time of trying to start with the batch file, addresses was updated for official.

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Automatic 'login' script

#96 Post by ZZZZZ » Fri Feb 21, 2014 1:33 am

Im not sure how the code for batch files works, but I was wondering how to put a random wait in between each client load, eg

Code: Select all

FOR /F "tokens=1 delims=" %%A in ('cd') do SET folder=%%A
START ../../micromacro.exe "%folder%/login.lua" acc:1 char:1 client:rom4ubot path:path1
wait random of 5
START ../../micromacro.exe "%folder%/login.lua" acc:5 char:1 client:rom4ubot path:path2
wait random of 5
START ../../micromacro.exe "%folder%/login.lua" acc:13 char:1 client:rom4ubot path:path3
wait random of 5
START ../../micromacro.exe "%folder%/login.lua" acc:9 char:3 client:rom4ubot path:path4
The other question I have is related to the 'current_client_lnk_in_use'. Is there any way to check the region, aka server, and run the client link that relates to that? Probably should have asked this in the UMM thread but its relevant here too I guess. When doing mini's etc on a US server it tried to restart client and opened Nexon. Not a fan of changing that value every time i go to run alts on different servers.

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

Re: Automatic 'login' script

#97 Post by rock5 » Fri Feb 21, 2014 1:54 am

There is no wait function for batch files. There may be some hacks that simulate a wait though such using pings. do a search online for something like "bat file wait" and see what you come up with.


I'm not sure what you are saying. Are you saying that you start a client with a batch file then if it restarts it uses the wrong link?
  • 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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Automatic 'login' script

#98 Post by ZZZZZ » Fri Feb 21, 2014 2:03 am

Sorry, should have explained better. When UMM restarts the client when mail fails or when fast login restarts after running a set amount of alts (3 in my case) it restarts using the' current_client_lnk_in_use'. I have that set to the Nexon client, but when I run alts on my US server I have to change that lnk to the US client.

And yeh, i looked up batch file waits a few days ago, there was stuff about using pings etc, guess i'll have another look into it.

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

Re: Automatic 'login' script

#99 Post by rock5 » Fri Feb 21, 2014 6:38 am

There is a version of loginnextchar here http://www.solarstrike.net/phpBB3/viewt ... 821#p52821 that allows you to specify a list of servers and their associated link, to be used automatically. I don't think you have to use the other 2 files to use it.
  • 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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Automatic 'login' script

#100 Post by ZZZZZ » Sat Feb 22, 2014 2:14 am

Awesome thanks. I'll give it a try and see how it goes :)

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests