Page 7 of 10

Re: Automatic 'login' script

Posted: Fri May 02, 2014 10:45 pm
by rock5
I'm thinking about setting up some predefined grids for the windows. So instead of calculating all the sizes and positions you could do something like this.

Code: Select all

rom/login acc:48 char:2 client:rom4u path:cot_tele grid:1,4,2
That would mean put the client and console on screen 1, use grid pattern 4 and in position 2 and it will position and size the client and console according to the pattern. For instance the video I posted could be a pattern. If it's pattern 2 the batch file could look like this instead.

Code: Select all

@echo off
START ../../micromacro.exe "%~dp0/login.lua" acc:11 char:2 client:rom path:rbassist grid:1,2,1
START ../../micromacro.exe "%~dp0/login.lua" acc:12 char:2 client:rom path:rbassist grid:1,2,2
START ../../micromacro.exe "%~dp0/login.lua" acc:13 char:2 client:rom path:rbassist grid:1,2,3
START ../../micromacro.exe "%~dp0/login.lua" acc:14 char:2 client:rom path:rbassist grid:1,2,4
What do you think?

Re: Automatic 'login' script

Posted: Sun May 04, 2014 11:13 pm
by Notorious
Hi, new version doesnt work properly

Re: Automatic 'login' script

Posted: Sun May 04, 2014 11:32 pm
by rock5
rock5 wrote:- IMPORTANT: I had Administrator add a function to MM that I needed. So this version of login requires you to update MM to the latest stable version 1.04.167. http://www.solarstrike.net/micromacro

Re: Automatic 'login' script

Posted: Sun May 04, 2014 11:47 pm
by Notorious
:oops:

Re: Automatic 'login' script

Posted: Sun May 11, 2014 4:43 am
by dx876234
Just a minor omission, the "pr()" function does not work for odd key types like functions :=)

So, I suggest a "tostring(key)" in the two instances u print keys.

-dx

Re: Automatic 'login' script

Posted: Sun May 11, 2014 4:51 am
by rock5
Sorry but I'm not sure what you are talking about. I can't see any pr statement in the login userfunctions.

If you are just talking about the functionality of pr, as far as I know pr does print functions. Example:

Code: Select all

/script pr(pr)
function: 1CD54618
Maybe you should just tell me what problem are you having exactly?

Re: Automatic 'login' script

Posted: Mon May 12, 2014 7:28 am
by noobbotter
I was wondering about setting which screen it goes to. I wasn't able to figure out how to tell it to go to my second screen. So R5, where you said you were thinking about setting up that grid thing, are you still working on that? I think that would be a nice way to implement it.

Re: Automatic 'login' script

Posted: Mon May 12, 2014 8:41 am
by rock5
You have to use the coordinates to put it on the screen you want. For instance my primary display is on the right. It's X range goes from 0 to 1280. My secondary display is on the left so it's X range goes from -1280 to 0. If the secondary display was on the right then the range would be from 1280 to 2560 I think.

Thanks for voicing an interest in the grid idea. Because of that it's more likely to happen. :) Do you have any grid arrangements you are particularly fond of?

Re: Automatic 'login' script

Posted: Wed May 14, 2014 12:50 pm
by noobbotter
A lot of time, I will run two bots on one screen (secondary screen, but like yours, on left) while actively playing on the other (primary) screen. I'd like to see a 4 section grid for the second display to show 2 instances of RoM with 2 MM windows. But then again, if I ever get around to trying out the model files thing, I could probably run 4 bots at once on one screen. That would require 8 "windows" but I probably would utilize both monitors if I were to run 4 bots at once, so there, it's still the same grid... 4 areas per screen.

Re: Automatic 'login' script

Posted: Wed May 14, 2014 10:49 pm
by rock5
Well an even 4x4 grid would obviously be included, so no worries there.

Re: Automatic 'login' script

Posted: Thu May 15, 2014 4:13 am
by ZZZZZ
How would I go about making Task Scheduler run the batch file to start client/mm? When I make it run it currently I get this error:
Task Scheduler error.jpg
When I run that exact same batch file manually it works as expected.

Re: Automatic 'login' script

Posted: Thu May 15, 2014 5:47 am
by rock5
Try filling in the "Start in" box with the rom folder.

Re: Automatic 'login' script

Posted: Thu May 15, 2014 8:08 am
by ZZZZZ
rock5 wrote:Try filling in the "Start in" box with the rom folder.
Wasn't sure if that would screw up how it starts lol.

Guess i'll just change all my batch files to this instead:

Code: Select all

START E:/micromacro/micromacro.exe "E:/micromacro/scripts/rom/login.lua" acc:67 char:2 client:rombot path:Path

Re: Automatic 'login' script

Posted: Thu May 15, 2014 8:21 am
by rock5
Yes that was the other option. I was going to mention it but I tested changing the "Start in" box and it worked, so that's all I mentioned.

Re: Automatic 'login' script

Posted: Thu May 15, 2014 6:50 pm
by ZZZZZ
Oh right, I completely missed what you ment by "start in" box haha, I was thinking more something in the batch file, even though there is no box :oops:

1 other thing, can you set channel that it enters using the batch file? I want to make it uses math.random(3) so they don't all log in on the same channel at the same time.

Re: Automatic 'login' script

Posted: Thu May 15, 2014 10:09 pm
by rock5
login doesn't have a channel option. It would require doing a mouse click which I just couldn't be bothered doing. Also login wouldn't know how many channels are actually available so it would have limited functionality.

I believe if you set

Code: Select all

fastLoginRegSel=nil
in the accountlogin.lua settings it will choose the channel randomly. I don't know why I have it set to 1 as default. I should probably change it to nil for future commits.

Re: Automatic 'login' script

Posted: Fri May 16, 2014 12:21 am
by dx876234
If you have a table where the keys are functions:

Code: Select all

function tt()
end

testTable = {}
testTable[tt] = tt

pr(testTable)
the pr command failes due to the attempt to append a function with a string in '(key and (key.."=")'.

Code: Select all

	function printline(value, key)
		if type(value) ~= "table" then
			--if value == nil then value = "nil" end
			value = string.rep(" ",spaces)..(key and (key.."=") or "")..tostring(value)
                                                  ^^
			if chatbox then
				chatbox:AddMessage(value,.8,.8,.8)
			else
				local tt = consolebox:GetText()
				consolebox:SetText(tt.."\n"..value,.8,.8,.8)
			end
		else
			printline((key and (key.."=") or "").."{")
                                 ^^
			spaces=spaces + tabsize
			for k,v in pairs(value) do
				printline(v,k)
			end
			spaces=spaces - tabsize
			printline("}")
		end
	end
This should be modified to ex.

Code: Select all

	function printline(value, key)
		if type(value) ~= "table" then
			--if value == nil then value = "nil" end
			value = string.rep(" ",spaces)..(key and (tostring(key).."=") or "")..tostring(value)
                                                         ^^
			if chatbox then
				chatbox:AddMessage(value,.8,.8,.8)
			else
				local tt = consolebox:GetText()
				consolebox:SetText(tt.."\n"..value,.8,.8,.8)
			end
		else
			printline((key and (tostring(key).."=") or "").."{")
                                  ^^
			spaces=spaces + tabsize
			for k,v in pairs(value) do
				printline(v,k)
			end
			spaces=spaces - tabsize
			printline("}")
		end
	end
-dx

Re: Automatic 'login' script

Posted: Fri May 16, 2014 1:52 am
by rock5
dx876234 wrote:function tt()
end

testTable = {}
testTable[tt] = tt

pr(testTable)
This code is faulty. Maybe what you meant was

Code: Select all

testTable["tt"] = tt
or

Code: Select all

testTable.tt = tt
A table key has to be a number or a string. It can't be a function.

Re: Automatic 'login' script

Posted: Sat May 17, 2014 1:38 pm
by dx876234
Ofc a function can be a key, anything can be a key. You even find examples of it in addons for Rom. (checkout some of Peryl's code)

Code: Select all

C:\Users\sample>lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> function tt()
>> end
>
> testTable = {}
> testTable[tt] = tt
>
> print(testTable[tt])
function: 004FDE08
>
>
Perfectly valid code....You probably was thinking of how to use a string as key, that corresponds to the special case u mention with table["tt"] = value or table.tt = value (without spaces), but thats just a special case.

Ref: http://stackoverflow.com/questions/1456 ... table-keys

-dx

Re: Automatic 'login' script

Posted: Sat May 17, 2014 7:53 pm
by rock5
That can't be right. But it looks like it is. I can't quite wrap my head around any situation where I would use such a feature but, ok, I'll add the change you suggested. I'll also add it to the 'else' part.

I should probably add something similar to the tableToString function I added to the bot recently.