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.
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Automatic 'login' script

#121 Post by rock5 » Fri May 02, 2014 10:45 pm

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?
  • 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

Notorious
Posts: 19
Joined: Thu Jan 02, 2014 7:46 am

Re: Automatic 'login' script

#122 Post by Notorious » Sun May 04, 2014 11:13 pm

Hi, new version doesnt work properly
Attachments
error.jpg

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

Re: Automatic 'login' script

#123 Post by rock5 » Sun May 04, 2014 11:32 pm

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
  • 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

Notorious
Posts: 19
Joined: Thu Jan 02, 2014 7:46 am

Re: Automatic 'login' script

#124 Post by Notorious » Sun May 04, 2014 11:47 pm

:oops:

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

Re: Automatic 'login' script

#125 Post by dx876234 » Sun May 11, 2014 4:43 am

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

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

Re: Automatic 'login' script

#126 Post by rock5 » Sun May 11, 2014 4:51 am

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?
  • 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

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

Re: Automatic 'login' script

#127 Post by noobbotter » Mon May 12, 2014 7:28 am

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.

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

Re: Automatic 'login' script

#128 Post by rock5 » Mon May 12, 2014 8:41 am

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?
  • 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

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

Re: Automatic 'login' script

#129 Post by noobbotter » Wed May 14, 2014 12:50 pm

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.

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

Re: Automatic 'login' script

#130 Post by rock5 » Wed May 14, 2014 10:49 pm

Well an even 4x4 grid would obviously be included, so no worries there.
  • 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

#131 Post by ZZZZZ » Thu May 15, 2014 4:13 am

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.

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

Re: Automatic 'login' script

#132 Post by rock5 » Thu May 15, 2014 5:47 am

Try filling in the "Start in" box with the rom folder.
  • 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

#133 Post by ZZZZZ » Thu May 15, 2014 8:08 am

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

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

Re: Automatic 'login' script

#134 Post by rock5 » Thu May 15, 2014 8:21 am

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.
  • 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

#135 Post by ZZZZZ » Thu May 15, 2014 6:50 pm

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.

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

Re: Automatic 'login' script

#136 Post by rock5 » Thu May 15, 2014 10:09 pm

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.
  • 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

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

Re: Automatic 'login' script

#137 Post by dx876234 » Fri May 16, 2014 12:21 am

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

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

Re: Automatic 'login' script

#138 Post by rock5 » Fri May 16, 2014 1:52 am

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.
  • 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

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

Re: Automatic 'login' script

#139 Post by dx876234 » Sat May 17, 2014 1:38 pm

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

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

Re: Automatic 'login' script

#140 Post by rock5 » Sat May 17, 2014 7:53 pm

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.
  • 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: Bing [Bot] and 1 guest