Conquer Club

Retrieval of specific game

Archival storage to keep things organized and uncluttered. Can't find what you need? Search for old topics here.

Moderator: Tech Team

Forum rules
Please read the Community Guidelines before posting.

Retrieval of specific game

Postby theherkman on Wed Dec 22, 2010 1:39 pm

How can I make a request of the CC api to retrieve all games by a specific user? Also, how can I request a specific game? Does the xml output of this request show which turns have been taken in the current freestyle round? If not, how can I extrapolate this information using api requests?
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby sherkaner on Wed Dec 22, 2010 1:53 pm

Wow, 4 questions. http://www.conquerclub.com/api.php gives the basic information (xml, check the source if it doesn't display properly).
1st: set p1un (or p1) to the value you want. So http://www.conquerclub.com/api.php?mode ... theherkman would give you the first 200 of your games, increase page number to get the rest.
2nd: set the game number, http://www.conquerclub.com/api.php?mode=gamelist&gn=1
3: Not entirely possible, the players will have a status. But at first a player might be waiting because he went last.
4. No way through the api afaik.
Colonel sherkaner
 
Posts: 1595
Joined: Thu May 03, 2007 3:21 am
Location: Zwolle

Re: Retrieval of specific game

Postby theherkman on Wed Dec 22, 2010 2:21 pm

Shoot... Okay, moving on to my next script... http://www.conquerclub.com/api.php?mode ... theherkman

I am looking to TEST a script I am writing for feudal war esc. These are the settings I will be testing it on. If all goes well I will figure out a way to open this up and add variables for personal customization. Right now I am using AHK, but will probably end up compiling it in something more user friendly. I have programed the page request and source code open. I also have activated the window and sent focus to the source. This all takes less than a second or two. How can I retrieve the contents of the source file for use with AHK so I can add variables and set up arrays and arguments?
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby Dako on Wed Dec 22, 2010 3:25 pm

That is an interesting question. I just didn't understand - what kind of source do you want to extract?
Image
User avatar
Colonel Dako
 
Posts: 3987
Joined: Sun Aug 26, 2007 9:07 am
Location: St. Petersburg, Russia

Re: Retrieval of specific game

Postby theherkman on Wed Dec 22, 2010 3:42 pm

Dako wrote:That is an interesting question. I just didn't understand - what kind of source do you want to extract?



Well originally I wanted to extract the entire source of the API so I could extrapolate which games need turns to be taken. For instance, in 4 player Feudal ESC, I want all turns to be taken unless there are only 2 players, or another player has entered my castle. I have used the code below to extract that info.

Code: Select all
^!f::                                 ;Start script with Ctrl+Alt+F
IfWinExist Mozilla Firefox Start Page - Mozilla Firefox
{
   WinActivate                           ;Check for FF Process
}
else                                 ;If none is running
{
   Run firefox.exe                           ;Start FF
   WinWait Mozilla Firefox Start Page - Mozilla Firefox            ;Wait until FF is launched
   WinActivate                           ;Give FF focus
}

Click 267, 63                              ;Give address bar focus

SetKeyDelay, 0                              ;No key delay
Send http://tinyurl.com/256o8ga{Enter}                     ;Input CC API URL

Sleep 1000                              ;Allow page load

RightClick 719, 164                           ;Open FF context menu

Click 812, 394                              ;Select source code page

IfWinExist Source of                           ;Find source window
{
   WinActivate                           ;Give focus
}

Click 812, 394                              ;Click to give focus to text area

send Ctrl+A                              ;Select source

Sleep 100                              ;Sleep for safety

send Ctrl+C                              ;Copy source

Sleep 100                              ;Sleep for safety


Then I will take the information from the clipboard and paste all the game numbers into a temp file that will be deleted at the end of the script. Then the script would load those games individually, checking to see if conditions are met for taking a turn. I plan to use a combination of the Game Log and BOB to ensure a player hasn't entered the castle. Then I will check for trade-ins. If I have less than 5 cards, I will deploy on the castle, bombard the correct territory, and end turn. This last step will require a large amount of programming from myself...
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby chipv on Wed Dec 22, 2010 3:50 pm

Basically automating your turns, right.
User avatar
Major chipv
Head Tech
Head Tech
 
Posts: 2814
Joined: Mon Apr 28, 2008 5:30 pm

Re: Retrieval of specific game

Postby Dako on Wed Dec 22, 2010 3:55 pm

Interesting, interesting, but I cannot say people will like it :).
Image
User avatar
Colonel Dako
 
Posts: 3987
Joined: Sun Aug 26, 2007 9:07 am
Location: St. Petersburg, Russia

Re: Retrieval of specific game

Postby theherkman on Wed Dec 22, 2010 3:56 pm

Only for 4 player Feudal ESC where there are more than 2 players remaining and no player has invaded your castle.
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby theherkman on Wed Dec 22, 2010 4:00 pm

This could take me a looooooooong time to finish. I still have to figure out how to feed the map info to the script. Is there an API request for a game that gives map info like who holds what and where that links to?
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby Dako on Wed Dec 22, 2010 4:00 pm

Nope. No army counts or anything. Just the log lines.
Image
User avatar
Colonel Dako
 
Posts: 3987
Joined: Sun Aug 26, 2007 9:07 am
Location: St. Petersburg, Russia

Re: Retrieval of specific game

Postby theherkman on Wed Dec 22, 2010 4:02 pm

Is there an API request for log? How does Bob know that yellow owns a territory right next to you and how is it able to highlight this in a foggy game? Wouldn't it show up as ? in the log?
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby chipv on Wed Dec 22, 2010 4:04 pm

Yes there is page you can request for this info (BOB gets it)... but I really wouldn't go down this road, people tend
to notice unusual speed of moves...
User avatar
Major chipv
Head Tech
Head Tech
 
Posts: 2814
Joined: Mon Apr 28, 2008 5:30 pm

Re: Retrieval of specific game

Postby Dako on Wed Dec 22, 2010 4:27 pm

The game page has that info. Not the API.
Image
User avatar
Colonel Dako
 
Posts: 3987
Joined: Sun Aug 26, 2007 9:07 am
Location: St. Petersburg, Russia

Re: Retrieval of specific game

Postby chipv on Wed Dec 22, 2010 4:32 pm

Dako wrote:The game page has that info. Not the API.


I didn't say API, and the game page does not have this info either (aside from scraping), you need an additional parameter.
User avatar
Major chipv
Head Tech
Head Tech
 
Posts: 2814
Joined: Mon Apr 28, 2008 5:30 pm

Re: Retrieval of specific game

Postby sherkaner on Wed Dec 22, 2010 4:43 pm

chipv wrote:
Dako wrote:The game page has that info. Not the API.


I didn't say API, and the game page does not have this info either (aside from scraping), you need an additional parameter.

Bob only gets the full log if needed, the rest is on the page now (especially the structure of the map and the placing of the armies).
Colonel sherkaner
 
Posts: 1595
Joined: Thu May 03, 2007 3:21 am
Location: Zwolle

Re: Retrieval of specific game

Postby chipv on Wed Dec 22, 2010 4:44 pm

Are we done now, boys? :-)
User avatar
Major chipv
Head Tech
Head Tech
 
Posts: 2814
Joined: Mon Apr 28, 2008 5:30 pm

Re: Retrieval of specific game

Postby sherkaner on Wed Dec 22, 2010 4:58 pm

Sorry :P
Colonel sherkaner
 
Posts: 1595
Joined: Thu May 03, 2007 3:21 am
Location: Zwolle

Re: Retrieval of specific game

Postby theherkman on Wed Dec 22, 2010 11:04 pm

Okay, thanks for the help. I will gladly plod along until I have more questions with the confusing API...
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby theherkman on Thu Dec 23, 2010 12:51 am

Okay, I have a question. How does BOB know when yellow has a territory next to player red in a foggy game? I can't figure it out... It's driving me nuts here...
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!

Re: Retrieval of specific game

Postby theherkman on Thu Dec 23, 2010 1:44 pm

Okay, doesn't matter anymore. New line of questioning... How can I bring focus to the in game action pane? I see an ID in the source code, but I only see one... Wouldn't that make the entire action pane one big form but with different variables to fill in?
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!


Return to Tool Archives

Who is online

Users browsing this forum: No registered users