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
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Automatic 'login' script

#21 Post by kenzu38 » Wed Feb 27, 2013 1:28 pm

Hey Bot_romka, thanks for the tip. Anyway, I think you should add another line to your code to fix spaces for the dirpath. Like what rock did in the login.lua:

Code: Select all

	dirpath = string.gsub(path," ","\" \"")
Anyway, rock, do you have an idea why my CPU usage is at 25% per client when I'm starting client.exe directly? Searched a bit in the forums and the RoM forums but couldn't find a topic exactly about this.

Anyway, since I don't have any problems with CPU usage when I start it through clientupdate.exe, I decided to just customize the code so it starts with clientupdate.exe. Although, I'm stuck because I don't know how to make the bot wait for the client update window before trying to click the play button. Can you please teach me how to do this?

Thanks.

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

Re: Automatic 'login' script

#22 Post by lisa » Mon Apr 08, 2013 1:33 am

I started to look into this but I figured you might have an idea of how to do what I want without me going through every line of code to learn how it works.

Basically the plan is to have a WP set up with a CharList = { stuff } as usual but have it so after X number of change characters it then kills that client and starts a new client and continues on with the next character in the list.

So kind of marrying together login() and LoginNextChar()

If you can't think of an easy way I will spend the time going through all the code to work out how to do it ;)


--=== Added ===--

I guess for my purpose I could just do a fresh client for each account change which would probably be easy to do, would still prefer to do after X change chars 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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Automatic 'login' script

#23 Post by rock5 » Mon Apr 08, 2013 9:53 am

I finally got login to work. I had to make a few changes to the bot. Where it uses "windowValid(__WIN)" on line 320 of functions.lua, I had to change it to "__WIN and windowValid(__WIN)". And change "not windowValid(__WIN)" on line 277 to "__WIN == nil or windowValid(__WIN)". And lastly I had to add " if not __WIN or not __PROC then return false end" to isInGame().

Administrator, maybe windowValid should return false if __WIN is nil instead of erroring.

I'll see about creating some sort of function for restarting the client.
  • 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: Automatic 'login' script

#24 Post by lisa » Mon Apr 08, 2013 11:05 am

Ahh I didn't think it was an easy to do thing I wanted, sounds like you have things sorted out pretty much ;)

I have 2 thoughts at the moment.
1. Have a long charlist of all accounts I want to run through minigames and start new client after 10 characters, I currently do 11 accounts but not all accounts are full, roughly 70 chars.

2. farm just frogs in KS and start new client after X number of runs, frogs are easier for low geared chars.
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: Automatic 'login' script

#25 Post by rock5 » Mon Apr 08, 2013 12:01 pm

I think I will start by just creating the function that will restart the client and load the character specified. Later, the code that chooses the next character to load would have to be changed to keep count and restart the client as well as change character. Maybe it can be added to changeChar itself.
  • 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

Ajoir
Posts: 32
Joined: Mon May 30, 2011 1:29 pm

Re: Automatic 'login' script

#26 Post by Ajoir » Fri Apr 12, 2013 7:26 am

I tryed use this function (version 1) in a waypoint, by don't get it works fine. I only get works when i use the sentece:

Code: Select all

 os.execute("start "..getExecutionPath().."/../../micromacro.exe "..getExecutionPath().."/login acc:3 char:1 client:client path:cot_tele")
the argument work fine. but i know this isn't the correct sentence. how i must use "os.execute"?
thank you in advance

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

Re: Automatic 'login' script

#27 Post by rock5 » Fri Apr 12, 2013 1:22 pm

I'm currently doing some work to get the userfunction 'login' working. The current version doesn't really work. Please be patient.
  • 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

Ajoir
Posts: 32
Joined: Mon May 30, 2011 1:29 pm

Re: Automatic 'login' script

#28 Post by Ajoir » Mon Apr 15, 2013 8:34 am

of course. I'm terribly sorry. I´m not speak english very well, and sometimes I don´t understand what you say; i thought it was finished. I don´t have any hurry. thank you very much for your work

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

Re: Automatic 'login' script

#29 Post by rock5 » Thu Apr 18, 2013 10:02 am

Just updated the scripts to version 3.

These work REALLY well. Up to my usual standard. :D

Check out the example on the first post on how to start multiple clients at the same time. It worked perfectly the first time I tried it.

Things to note:
- The script uses a small text file in the 'scripts' folder to keep track of which micromacro has an active client for mouse clicks so there should never be conflicts unless you are using more than 1 micromacro folder.
- I will be shortly realeasing an update to the LoginNextChar userfunction that will have the option to restart the client after a certain number of character changes, to avoid crashes. So you can look forward to that too.
- I've changed the syntax of the login function (not the login.lua format) to make it more userfriendly.

Enjoy.
  • 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
attackspeedzero
Posts: 28
Joined: Sat Mar 02, 2013 6:24 pm

Re: Automatic 'login' script

#30 Post by attackspeedzero » Thu Apr 18, 2013 11:21 am

Works great! One suggestion if I may, maybe have a default client name so the argument doesn't need to be passed in if that shortcut exists?

Is there any way to work around it needing to move the mouse to choose account and character? Some automation programs can send mouseclicks to a coordinate pair without actually moving the mouse... just a thought!

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

Re: Automatic 'login' script

#31 Post by rock5 » Thu Apr 18, 2013 1:12 pm

I was going to say, it remembers the last link used in a variable and uses that, even when using the login.lua script, but it looks like I made a small mistake. I made the login function require the client argument when it should be using that variable if it exists.

The problem with your suggestion is the default link would always initially need to be specified unless it is hard coded into a file. Then the file would be modified. But, if you want to, once I fix the mistake you should be able to add

Code: Select all

current_client_lnk_in_use = "linkname"
To the top of the userfunction_login file for it to act as a default.

Hm... maybe I should add an actual default, eg.

Code: Select all

current_client_lnk_in_use = "rom" 
Then users, who only have one client, just need to make sure they name their link "rom" so they wont need to edit the default. I think that's a good idea.

Edit: oh, and no, we can't click the mouse without moving the mouse. I think it's not possible with this game. If the client pops up while you are doing something, just stop a second while it does it's thing.
  • 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

#32 Post by Bot_romka » Thu Apr 18, 2013 11:32 pm

Hi All.
Its possible from micromacro set client window is active (on top) ?
I need just reenter in game after disconnect from server. maybe its possible without start new client ?

p.s. and how to check client window is active ?

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

Re: Automatic 'login' script

#33 Post by rock5 » Fri Apr 19, 2013 5:50 am

You can set the client window active with

Code: Select all

showWindow(getWin(), sw.show)
Bot_romka wrote:I need just reenter in game after disconnect from server. maybe its possible without start new client ?
It's not so easy. First the 'login' function is not written to log in to an already started client, it would have to be changed. Secondly, you would have to be constantly monitoring the client to see if it was disconnected. Then you probably can't log right in but have to wait awhile. And the currently running waypoint file would have to pause without crashing.

It's obvious that the login function is ideal for recovering from errors and crashes but it raises it's own problems so I haven't dealt with it yet. But I predict that even if the client can be restarted after a crash the bot might still fail because it was still using old memory addreses.

If you want to look into it you should check out the onError callback functions.

The login function uses it's own function to check the status of the client but you could use 'isInGame()'. It returns true only if fully in the game.
  • 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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Automatic 'login' script

#34 Post by rock5 » Fri Apr 19, 2013 11:04 am

Ok, I updated the userfunction_login.lua file, now 3.1. Now if you name your link "rom" it will be used by default, no need to specify it. If you want to change the default you can change the variable at the top of the file.
  • 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: Automatic 'login' script

#35 Post by lisa » Tue Apr 23, 2013 8:01 pm

I keep getting the print

Code: Select all

No client shortcut link specified. Not restarting client.
set it to "rom"
local current_client_lnk_in_use = "rom"
link is set to rom.

the rom/login works fine

Code: Select all

Script> rom/login acc:7 char:6 path:andy1
Opening login.lua...
Starting script execution - Press CTRL+C to exit.
Press CTRL+L to cancel execution and load a new script.
--------------------------------------------------------
C:/micromacro/scripts/rom
Press the (F6) key to stop/pause the script.
You can resume with the (F5) key.

    Rock5s 'login' script. Version 3

Starting client rom ...
Clicking account 7 ...
Selecting character 6 ...
Waiting until in-game ...
Stopping execution.
userfunction_login is 3.1
local VERSION = 3.1

userfunction_loginnextchar is 1.5
Version 1.50

loginxml is 3.2


I tried with userfunctions in romblobal and in te normal userfunctions folder.


ok worked out the issue.

in userfunction_login current_client_lnk_in_use is local but it is used in userfunction_loginnextchar, I removed the local and it works fine.
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: Automatic 'login' script

#36 Post by rock5 » Wed Apr 24, 2013 3:15 am

Thanks. I'll update 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

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

Re: Automatic 'login' script

#37 Post by lisa » Thu Apr 25, 2013 1:38 am

I for one am loving this, set mine to 8 character changes and I run all my andor, CoT, Surv. I just set it off and come back many hours later and all chars are done doing what I wanted them to do, I used to have to just do 1 account and then manually restart or it would eventually crash.

Ideally I'd prefer it to restart client after each account is finished but for now the 8 character changes does the trick ;)
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: Automatic 'login' script

#38 Post by rock5 » Thu Apr 25, 2013 2:16 am

It's good to hear that it works well even when heavily used.
lisa wrote:Ideally I'd prefer it to restart client after each account is finished but for now the 8 character changes does the trick
Seeing as the crashing is related to how many character changes you do, the way I set it up is I think, technically speaking, the right way to go.

You could always manually restart in your relog if on last character

Code: Select all

if IsLastChar("changechar") then
Hm... not so easy. You can relog into the same character easy enough but to log into the next character you would need to get the next character. Maybe I should have made "GetNextChar" global. Then you could do

Code: Select all

nextChar, nextAcc = GetNextChar()
if nextAcc and nextAcc ~= getAcc() then
     ChangeCharRestart(nextChar, nextAcc)
     return -- or break. To stop the rest of relog code
end
just before the "LoginNextChar()"
  • 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: Automatic 'login' script

#39 Post by lisa » Thu Apr 25, 2013 3:02 am

It's ok, if I get the motivation i will just change the userfunction to do it, for now it is fine and the less effort I have to do the better, bit sick atm.
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: Automatic 'login' script

#40 Post by dx876234 » Fri May 03, 2013 3:14 am

Browsing through to add more login buttons I noticed something, column 3 and 4 both have "col=3", assuming this is typo?

-dx

Code: Select all

	a=a+1 ba[a]={row=a,col=1} ba[a+12]={row=a,col=2} ba[a+18]={row=a,col=3}                        ba[a+29]={row=a,col=5} ba[a+41]={row=a,col=6} ba[a+53]={row=a,col=7}
	a=a+1 ba[a]={row=a,col=1} ba[a+12]={row=a,col=2} ba[a+18]={row=a,col=3} ba[a+23]={row=a,col=3} ba[a+29]={row=a,col=5} ba[a+41]={row=a,col=6} ba[a+53]={row=a,col=7}
	a=a+1 ba[a]={row=a,col=1} ba[a+12]={row=a,col=2} ba[a+18]={row=a,col=3} ba[a+23]={row=a,col=3} ba[a+29]={row=a,col=5} ba[a+41]={row=a,col=6} ba[a+53]={row=a,col=7}
	a=a+1 ba[a]={row=a,col=1} ba[a+12]={row=a,col=2} ba[a+18]={row=a,col=3} ba[a+23]={row=a,col=3} ba[a+29]={row=a,col=5} ba[a+41]={row=a,col=6} ba[a+53]={row=a,col=7}
	a=a+1 ba[a]={row=a,col=1} ba[a+12]={row=a,col=2} ba[a+18]={row=a,col=3} ba[a+23]={row=a,col=3} ba[a+29]={row=a,col=5} ba[a+41]={row=a,col=6} ba[a+53]={row=a,col=7}
	a=a+1 ba[a]={row=a,col=1} ba[a+12]={row=a,col=2} ba[a+18]={row=a,col=3} ba[a+23]={row=a,col=3} ba[a+29]={row=a,col=5} ba[a+41]={row=a,col=6} ba[a+53]={row=a,col=7}

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests