Jump to content
Sign in to follow this  
heretician

Complete AutoIt newbie looking for some help with an easy script

Recommended Posts

heretician

First off I want to state that this script is for an internet-based game called eRepublik (www.erepublik.com) although using scripts to automate things like messaging people, and adding friends is COMPLETELY LEGAL in their and there is no restriction in their Terms and Conditions and Admins sometimes even help people write macros and whatnot for running these types of things. So please do not lock or move this thread; if anyone knows about eRepublik and could reply and vouch that this is allowed - please do so. If this would help convince the moderators and admins -- Here are two sites that are recognized by eRepublik and often linked and spread around ingame by eRepublik admins and citizens alike that include tools that grab more API information from eRepublik than what my Auto-Friend-Adder does: http://erepublik.ws & http://erepmarket.co.cc/index.php

Onto what I need help with:

What I am wanting is to write a script that simply clicks a link, delays for a few milliseconds (enough time for the link to load) and the clicks the next link. Now this would be a lot harder than it is, although a few years back someone wrote an HTML page that automatically grabs profile links. Take a look at the HTML page that I am wanting AutoIt to use:

http://ereptools.dmv.com/FedPartyList.html

Very simply, I am just wanting to create an AutoIt script that clicks the "FRIEND" link from 001 to 737, the bottom of the list. If it is possible, maybe even click the "FRIEND" links on the "Changes from Yesterday"

As you can see written on the top, there once was script written for this, although it is lost and the original creator is nowhere to be found. Now it is up to me to begin working on making a new one.

Is there anybody out there who could assist me? I know this is an extremely easy script to compile and create, although I have absolutely no clue how to do it and before I posted I researched on both the AutoIt online documentation and the helpfile that is included in the AutoIt download and I could not find nothing that deals with using AutoIt to click pages on the internet.

Thank you for taking the time to read this and I hope hope hope there is someone out there who could help =)

-Nick

Share this post


Link to post
Share on other sites
heretician

I was looking around and stumbled upon this:

http://www.autoitscript.com/forum/index.php?showtopic=95595

It is a Firefox AutoIt script -- and I use Firefox.. I was wondering if there was a way to use this FF.au3 script to integrate into a script to create this auto clicker so I can click on the .au3 and it would open up Firefox and open up this Fed Party List (I would also have to add something to where it would open up eRepublik.com beforehand and login to my account, it can close the window afterward I believe, I just have to be logged in after Firefox is opened.

Just trying to brainstorm on how I would do this.. I bet I look like a complete newbie to some of you, I apologize -- I know nothing about writing macros sadly =(

Share this post


Link to post
Share on other sites
Tvern

5 RESTRICTIONS ON RIGHT TO USE

5.1 You agree that you shall not (and you agree not to allow any third party to):

...

5.1.3 use any robot, spider, website search/retrieval application, or other automated device, process or means to access, retrieve or index any portion of the Website and/or the eRepublik.com Service, other than for the purposes of using the eAPI System and then only as allowed by the functionality of the eAPI System

So regardless of if this rule is being enforced, scripts like this are not allowed.

If a game features an online multiplayer component and you are attempting to automate it, discussion of such bots is not allowed here.

So even if a game demands you use autoit to automate it you would still not be allowed to discuss it here.

Share this post


Link to post
Share on other sites
heretician

You kind of missed the first sentence bud

"other than for the purposes of using the eAPI System and then only as allowed by the functionality of the eAPI System"

That HTML page is using the eAPI system to retrieve that information, and it is perfectly allowed by the functionality of the eAPI system. It has nothing to do with the rule being enforced -- That rule is enforced, very strictly. If you would like, you can contact the admins and ask them -- the Fed Party List is a well known page and i'm sure they even know about it.

And I read the entire announcement, did you?

If you create a thread to automate a game you need to make sure the game doesn't explicitly forbid it and that it does not feature multiplayer.

The 'automation' of adding a friend is not a multiplayer component of the game, the communication thereof between two players may be -- but it takes a single person to click that button. This is not a complex algorithm that is going on here.

As far as I know though, you are not a moderator and this thread is not yet closed -- I don't know if you just had a bad day and decided to try and ruin this thread (I explicitly explained that it is completely legal to do this in eRepublik) but might I be correct by saying that it is not your place to enforce Valik's announcement? Furthermore, your entire post is potentially invalidated simply due to the fact that you inaccurately interpreted, "what my link said?" Simply reading the first part of a paragraph and not the last part is bad performance when are you impersonating a figure of authority.

Anyway, moderators or administrators -- if you feel the need to close this thread then so be it, I will find another Macro site to post this on and simply copy paste what I posted here. I chose AutoIt out of the hundreds of Macro programs simply because a friend of mine referred me to it stating that it was a very efficient way to use a macro.

As you can see though, moderators or administrators, Tvern incorrectly interpreted the Terms that were written on "what my link said" IE: the Terms and Conditions. the FedPartyList.html page is using the eAPI system to grab the list of usernames.

Thanks for your attempted assistance Tvern, and I would rather not debate this further with you but I am going to go ahead and take a wild guess that if this thread ends up not being closed by a moderator or administrator -- you will be replying with more of your erroneous insinuations.

Share this post


Link to post
Share on other sites
JohnOne

Shirley the native community and its administrators would be better suited to help you using an API of their own website.

But antway, yes you could use FF.au3, you could also use IE.au3 (which is a standard UDF that comes with autoit, and is documented in the help file.

Also there are literally hundreds of examples on this forum of how to click links and automate webpages.

To be honest, I'm struggling to see how to have the time to post long winded replies to make some sort of epoint, instead of searching the forums.

IE is the easier of the 2 UDFs purly because of its hany documentation and examples in the helpfile.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Tvern

You can generally expect someone to reply when you get personal like that.

When I see someone ask for anything to do with automating any part of a mmo game on this forum I just point out to them what the rules are on this subject. I try to do so in a factual way, without making accusations, or preaching morality.

What the OP, or any other user does from that point on is completely up to them. Enforcing Valik's statements would be hard for me anyway, given that, as you noted, I am not a moderator.

Now the announcement is very clear that any game that features multiplayer is not to be automated at all. That is actually in your own quote.

In this case it is a little more complicated as you are using the in-between site to get the game data, but most people get very little response when:

- asking for any game bot related help.

- asking for help without supplying any code of their own.

- being hostile to other members without being provoked.

If you have any questions on how to get started with autoit there are some links here

If you want to read some guidelines about asking for help on the forums read this

Share this post


Link to post
Share on other sites
heretician

I understand completely, and I do understand why you replied in the first place. I apologize for any personal insult you took to my reply -- what set me off is you went to eRepublik and misunderstood their terms. I am using their eAPI which is completely a-OK

Now I did not know that any multiplayer was forbidden when I first made this post and I apologize for that, but the main part of your first reply was stating that the game itself disallowed it, and that my own link was incriminating myself, which it was not.

Anyway -- I have found out how to do it although it is a lengthy process and involves another macro program. JohnOne -- I am a complete newbie to macros and scripting -- I know you may see it as unbelievable that someone does not know how to use scripting to automate webpages but I do not.. Could you please link me to one of those hundreds of articles that details on how to use AutoIt to click links and automate webpages, if you would take a look at the FedPartyList page that I linked, it should be easier for you to refer me to the right article. And again, as my original post said, I did search around -- quite a bit, even on the forums -- as you even noticed I did because you restated my questions about FF.au3 and I was not trying to make an "epoint" (Slang for an internet point? That's cool!?) I was trying to legalize my own topic so that I could get an answer that I actually desperately need.

Tvern, I did expect a reply that's why I even posted about you replyed :blink: But anyway, no harm done and no hard feelings. It seems my thread did not get closed yet though! Is there any chance at all either of you or someone could point me towards the right article that would tell me about automating webpages or clicking links? I can not find one that will work with what I am trying to do other than making a macro that has Mouse Position X,Y over and over again and I have to find the mouse position; which would take a few hours of work heh

Share this post


Link to post
Share on other sites
Tvern

The thing is you're not using the eAPI directly. Instead you're botting a page that supposedly does use it. However since you're not actually botting the game this might be allowed.

Then again, I suppose that once you navigate to one of the links, you are once again botting the game ittself, so I'd be interested what a mod has to say on this.

I would advise you to learn how to use the eAPI to achieve what you are trying to do directly and cut out the middle man, but to leave on a positive note I'll try and help you with this.

;the problem with emulating link clicks is that you have to return to the main page each time, then wait for it to load, then click the next link.
;in this example I load the main page once, get all the links present, then load them one after the other, without having to return.

#include <ie.au3>                                                           ;include the functionality of IE.au3
#include <array.au3>                                                        ;just here for _arraydisplay on line 9 (debug) 
$oIE = _IECreate("http://ereptools.dmv.com/FedPartyList.html")              ;navigate to the page (window can run invisible too)
$sSource = _IEDocReadHTML($oIE)                                             ;read the source code of the page
$aLinks = StringRegExp($sSource,'com/citizen/friends/add/(\d*?)"',3)        ;looks for 'com/citizen/friends/add/(some digits here)"' in the page source and puts the digets of all matching results into an array.
;~ _ArrayDisplay($aLinks)                                                   ;uncomment if you want to see the result of stringregexp. (debug) 
;You have to be logged in to eRepublic for the next part.
$uBound = UBound($aLinks)                                                   ;count the amount of elements in the array
For $i = 0 To $uBound -1                                                    ;a loop that repeats line 13 to 15, but increases $i by 1 each time untill the last element in $aLinks is reached.
    $sUrl = "http://www.erepublik.com/citizen/friends/add/" & $aLinks[$i]   ;recreate a valid url from the numbers in linkarray. Notice that, because $i increments, this doesn't just generate the same link over and over.
    ConsoleWrite("Loading link: " & $sUrl & @CRLF)                          ;shows what link is loading in the console (debug) 
    _IENavigate($oIE,$sUrl)                                                 ;load the link
Next                                                                        ;the end of the loop (return to line 12)
ConsoleWrite("Script finished" & @CRLF)                                     ;a notification that thse script is finished. (debug)

Now if another step is neaded to confirm adding a friend that is technically botting without using eAPI.

Share this post


Link to post
Share on other sites
heretician

Thanks so much =) I haven't given it a try yet but I will.

But there is a fix to your problem! On FireFox, if you go ahead and open eRepublik and signin first (you have to sign in first, but I am talking about leaving eRepublik open) it will not attempt to go to the page after every click.

And I agree, after our debate -- I would definitely be interested on what a moderator or administrator would have to say about this =) You may be right though, or more than right -- they may view this as botting entirely. I don't because it is all one sided and it does not affect any part of the game in a negative way, but there are definitely more ways to view botting than the perspective that I just took.

Using the eAPI is extremely hard, and most people only use it for spreadsheets.. I would not even know how to BEGIN using it for a function like this =/

Thank you so much for the script though, i'll make sure to post again and let you know.. In meantime HEY MODS come check out my thread and see if i'm legal :blink:

The thing is you're not using the eAPI directly. Instead you're botting a page that supposedly does use it. However since you're not actually botting the game this might be allowed.

Then again, I suppose that once you navigate to one of the links, you are once again botting the game ittself, so I'd be interested what a mod has to say on this.

I would advise you to learn how to use the eAPI to achieve what you are trying to do directly and cut out the middle man, but to leave on a positive note I'll try and help you with this.

;the problem with emulating link clicks is that you have to return to the main page each time, then wait for it to load, then click the next link.
;in this example I load the main page once, get all the links present, then load them one after the other, without having to return.

#include <ie.au3>                                                           ;include the functionality of IE.au3
#include <array.au3>                                                        ;just here for _arraydisplay on line 9 (debug) 
$oIE = _IECreate("http://ereptools.dmv.com/FedPartyList.html")              ;navigate to the page (window can run invisible too)
$sSource = _IEDocReadHTML($oIE)                                             ;read the source code of the page
$aLinks = StringRegExp($sSource,'com/citizen/friends/add/(\d*?)"',3)        ;looks for 'com/citizen/friends/add/(some digits here)"' in the page source and puts the digets of all matching results into an array.
;~ _ArrayDisplay($aLinks)                                                   ;uncomment if you want to see the result of stringregexp. (debug) 
;You have to be logged in to eRepublic for the next part.
$uBound = UBound($aLinks)                                                   ;count the amount of elements in the array
For $i = 0 To $uBound -1                                                    ;a loop that repeats line 13 to 15, but increases $i by 1 each time untill the last element in $aLinks is reached.
    $sUrl = "http://www.erepublik.com/citizen/friends/add/" & $aLinks[$i]   ;recreate a valid url from the numbers in linkarray. Notice that, because $i increments, this doesn't just generate the same link over and over.
    ConsoleWrite("Loading link: " & $sUrl & @CRLF)                          ;shows what link is loading in the console (debug) 
    _IENavigate($oIE,$sUrl)                                                 ;load the link
Next                                                                        ;the end of the loop (return to line 12)
ConsoleWrite("Script finished" & @CRLF)                                     ;a notification that thse script is finished. (debug)

Now if another step is neaded to confirm adding a friend that is technically botting without using eAPI.

Share this post


Link to post
Share on other sites
heretician

Wow.. You sure are a pro at these scripts.. This is the most efficient friend request script I have ever seen, and we have been using that FedPartyList for over a year, most of them took 2 hours + to finish completely, this one would finish in an hour TOPs and most of the scripts we went through would eventually end up clicking a wrong button and trying to press mail instead or going to their profile or going to some random page in eRepublik.

Only problem is, with all its efficiency, it will not run its full course? So far I have got it to the end of the B's -- although I have only tried it 3 times. Is there any particular reason why it just stops all of the sudden? It will go and go and go and then just stop abruptly like I exited out of it or something.

The first try I just ran the script, the last few tries I have been using a compiled EXE and that seems to be running better..

You don't know it Tvern, but you just created an AutoIt fanatic. After using this I downloaded the AutoIt 1-2-3 and I plan on learning as much as possible about this... And there are so many possibilities with AutoIt, it is not just a macro program, it can do EVERYTHING! I love it! :blink: Thank you so much Tvern for arguing/debating with me and eventually getting me involved into AutoIt ;)

Is there anything I can do to make it run all the way? Did you make it to where it would randomly stop? The first time I used "Run Script" it stopped after the third link, I am about to go on my 4th try and it seems every try it gets a little bit further.. I know nothing about AutoIt at the moment but when I do learn, i'm going to make a simple GUI for this and make it to where it will resume where it left off =) Eventually I want to learn about the eAPI and use AutoIt to directly grab from the eAPI, I was thinking instead of using this FedPartyList (which is actually a few months out of date) I could easily do something like...

Have the script go to http://www.erepublik.com/en/party-members/federalist-party-2263/1 (it is the full list of every Federalist Party Member) IE: FedPartyList hehe... And it will grab each persons profile ID from each page, store it, and then just add the "http://www.erepublik.com/citizen/friends/add/" before the ID.. Would this work Tvern? I think the hardest part would be getting it to go page-by-page.

Also, the User #1 on eRepublik "Admin" finally responded to my inquiry.. He told me that anything that you do not have to log in to obtain is not against the terms of service, I just checked and to go to http://www.erepublik.com/en/party-members/federalist-party-2263/1 I did not have to log in. He forewarned me about trying to do things like trying to automate my account to where it would automatically log in and do everything I am supposed to do on the account (work, study, train, etc) -- That would take the fun out of the game anyway but still, even without logging in.. The possibilities of things I could create if I learned AutoIt!!! =)

Meh i'm rambling now.. Tvern, do you know the problem with your script? Did you even test it out yourself? You had to of heh, this sucker works like a charm. I showed it to our Party President and he loved it. I'm a bit ashamed to show him this thread but I think i'm going to send him a PM and link him to it anyway, he has to see the types of things I could do if I learned it =) Get myself an ingame promotion hehe..

Thanks so much again.. And even if you don't help me make it to where it works 100% all the way through, you've been a great help and I consider you a friend even if the feeling is mutual. I have to admit, I even enjoyed our debate. Atleast it was with someone intellectual heh.

EDIT:

I did not know what the Array Display was so I tried to take the comment off so I could try it and see what it was, but it would not let me compile it after I took it off, I tried leaving the ~ and it still would not compile.. Don't know why but it will only compile with that Array Display thing commented =/

Edited by heretician

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.