Page 5 of 10

Re: Automatic 'login' script

Posted: Sat Aug 24, 2013 9:39 am
by turbobay
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 ?

Re: Automatic 'login' script

Posted: Sat Aug 24, 2013 10:02 am
by rock5
What does the message say exactly?

Re: Automatic 'login' script

Posted: Sat Aug 24, 2013 12:56 pm
by BlubBlab
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 ?

Re: Automatic 'login' script

Posted: Sat Aug 24, 2013 1:15 pm
by turbobay
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.

Re: Automatic 'login' script

Posted: Sat Aug 24, 2013 1:42 pm
by BlubBlab
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

Re: Automatic 'login' script

Posted: Sat Aug 24, 2013 2:32 pm
by rock5
To tell you the truth, I'm not an expert on Windows security. It might be UAC security. You should do a search online.

Re: Automatic 'login' script

Posted: Sat Aug 24, 2013 10:15 pm
by BlubBlab
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.

Re: Automatic 'login' script

Posted: Fri Aug 30, 2013 9:52 am
by BlubBlab
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?

Re: Automatic 'login' script

Posted: Mon Sep 02, 2013 4:59 am
by lolita
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>

Re: Automatic 'login' script

Posted: Mon Sep 02, 2013 5:20 am
by BlubBlab
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

Re: Automatic 'login' script

Posted: Mon Sep 02, 2013 5:41 am
by rock5
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.

Re: Automatic 'login' script

Posted: Wed Dec 18, 2013 5:44 pm
by Bot_romka

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()

Re: Automatic 'login' script

Posted: Mon Feb 03, 2014 9:44 am
by ZZZZZ

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.

Re: Automatic 'login' script

Posted: Mon Feb 03, 2014 10:03 am
by rock5
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.

Re: Automatic 'login' script

Posted: Mon Feb 03, 2014 10:29 am
by ZZZZZ
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.

Re: Automatic 'login' script

Posted: Fri Feb 21, 2014 1:33 am
by ZZZZZ
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.

Re: Automatic 'login' script

Posted: Fri Feb 21, 2014 1:54 am
by rock5
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?

Re: Automatic 'login' script

Posted: Fri Feb 21, 2014 2:03 am
by ZZZZZ
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.

Re: Automatic 'login' script

Posted: Fri Feb 21, 2014 6:38 am
by rock5
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.

Re: Automatic 'login' script

Posted: Sat Feb 22, 2014 2:14 am
by ZZZZZ
Awesome thanks. I'll give it a try and see how it goes :)