Variable reading and timeout loop

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Dalac
Posts: 2
Joined: Fri Jun 29, 2018 12:55 am

Variable reading and timeout loop

Post by Dalac » Fri Jun 29, 2018 1:30 am

Hi everyone! I'm just got iMacros cause I need it to create a bot for my economical simulator. In this game, you have to fight 10 times a day and work once to get paid.
If there are people who want to help, I would really appriciate it.
The theory it's simple, but I have no ideea how to write the code.

My plan is to write this bot that it can automatically fight 10 times, with a break of 10 minutes between each fight. I could do this by simply recording the macro, but there are some problems.
I can't beat someone who has more energy than me. So, I'm looking for a code that can read my victim's energy, and if the number is bigger than 5 (for example), than return and find another one who has less.
I've put here a printscreen that shows how this menu looks. The code should read vitim's energy from this menu, check if it is bigger than 5 and return to the list for searching another one with less energy. Or if it's possible to figure out from the begining the one that has less than 5% energy, why not.
I've thought that going by inspect element in chrome may help me. I located the line where energy is displayed, but I have no ideea how to write the code.

I've started building this code, but it can only do simple tasks cause I dont know how to improve it yet.
------------------------------------------------------------------------------------------------------------------------------

Code: Select all

VERSION BUILD=1002 RECORDER=CR
URL GOTO=http://www.marketglory.com/account
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=588
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=587
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=588
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=589
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=601
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=603
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=602
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=603
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=606
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=605
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

You can notice here that I copied the tasks because there are 10 fights to do and I want the macro to keep running. As I said, there is a timeout of 10min between fights, and I added that with a difference of couple seconds
so I'm safe from getting banned, cause they could check that I'm doing my fights every day at the same interval. I will keep editing this timeout.
So, besides variable reading, I would also need a loop with an timeout of 10min between each task group.

I really want to learn some coding commands, as a begginer. If you guys can help me with that, I would really appriciate it.

As a summary, I need a code for reading variables who can chose the victim that has the energy under 5% and a loop one, with a timeout of 10mins between each fight, who would simplify that long code.
A tested fight, is defined by that:

Code: Select all

URL GOTO=http://www.marketglory.com/account
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
Thank you all. I'm hoping for a solution.
Attachments
Capture.PNG
energy tab menu
chivracq
Posts: 8136
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Variable reading and timeout loop

Post by chivracq » Fri Jun 29, 2018 11:59 am

Dalac wrote:Hi everyone! I'm just got iMacros cause I need it to create a bot for my economical simulator. In this game, you have to fight 10 times a day and work once to get paid.
If there are people who want to help, I would really appriciate it.
The theory it's simple, but I have no ideea how to write the code.

My plan is to write this bot that it can automatically fight 10 times, with a break of 10 minutes between each fight. I could do this by simply recording the macro, but there are some problems.
I can't beat someone who has more energy than me. So, I'm looking for a code that can read my victim's energy, and if the number is bigger than 5 (for example), than return and find another one who has less.
I've put here a printscreen that shows how this menu looks. The code should read vitim's energy from this menu, check if it is bigger than 5 and return to the list for searching another one with less energy. Or if it's possible to figure out from the begining the one that has less than 5% energy, why not.
I've thought that going by inspect element in chrome may help me. I located the line where energy is displayed, but I have no ideea how to write the code.

I've started building this code, but it can only do simple tasks cause I dont know how to improve it yet.
------------------------------------------------------------------------------------------------------------------------------

Code: Select all

VERSION BUILD=1002 RECORDER=CR
URL GOTO=http://www.marketglory.com/account
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=588
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=587
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=588
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=589
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=601
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=603
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=602
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=603
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=606
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
WAIT SECONDS=605
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

You can notice here that I copied the tasks because there are 10 fights to do and I want the macro to keep running. As I said, there is a timeout of 10min between fights, and I added that with a difference of couple seconds
so I'm safe from getting banned, cause they could check that I'm doing my fights every day at the same interval. I will keep editing this timeout.
So, besides variable reading, I would also need a loop with an timeout of 10min between each task group.

I really want to learn some coding commands, as a begginer. If you guys can help me with that, I would really appriciate it.

As a summary, I need a code for reading variables who can chose the victim that has the energy under 5% and a loop one, with a timeout of 10mins between each fight, who would simplify that long code.
A tested fight, is defined by that:

Code: Select all

URL GOTO=http://www.marketglory.com/account
TAG POS=2 TYPE=SPAN ATTR=TXT:Lupte<SP>Referali
TAG POS=1 TYPE=A ATTR=TXT:Ataca
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:http://www.marketglory.com/account/fight/view_fight/319762 ATTR=NAME:test
Thank you all. I'm hoping for a solution.
Hum..., nice "Effort" in your Post from a quick look..., but "FCIM" for me to read... (Read my Sig...)
=> iMacros for CR v10.0.2(...?), 'Free' or 'PE' (Personal Edition)...?, CR v...?, OS...?
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Dalac
Posts: 2
Joined: Fri Jun 29, 2018 12:55 am

Re: Variable reading and timeout loop

Post by Dalac » Fri Jun 29, 2018 12:07 pm

I got that iMacros extension for chrome.
chivracq
Posts: 8136
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Variable reading and timeout loop

Post by chivracq » Fri Jun 29, 2018 12:16 pm

Dalac wrote:I got that iMacros extension for chrome.
8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply