• 0

Need some help with a script.


Question

Hey guys, on my site DominateDominion.com I am trying to have a table that updates every day. Basically, I play a game called League of Legends and they have a map called Dominion. There is no ranked mode for dominion, but I was given some files that can get the players elo. I have a note pad where I type in the person's usernamer whos elo I want to find out, then I run a batch file, and open results.txt and it gives the players elo. The guy who gave me the files said all I need for it to update on my site automatically each day was a script where it dumps all the users from the site to a file, runs the batch file, then sends the update back to the server. So how could I do this? I'm don't know any programming or anything at all. Where should I start looking?

Link to comment
https://www.neowin.net/forum/topic/1057344-need-some-help-with-a-script/
Share on other sites

Recommended Posts

  • 0

Ok, at the end of your batch script (open it in Notepad), paste this:

ftp -i -n -s:"%~f0"
open dominatedominion.com
user USERNAMEHERE
PASSWORDHERE
cd public_html
literal pasv
binary
put results.txt
disconnect
bye

Then tell us if it's successfully uploaded to http://www.dominated...com/results.txt

If so, we can help you get it from that, to displayed in a table on your website, and then tell you how to automate it. :)

IT WORKED!! So I am getting close? Ahhhh I can smell it!

  • 0

Yep works, getting there. I see that this is that jadebot thing i saw when researching this, would of thought there be a way to get it to work with a server but not sure how maybe a smart coder could figure it out :/

http://na.leagueoflegends.com/board/showthread.php?t=1294429

  • 0

Yep works, getting there. I see that this is that jadebot thing i saw when researching this, would of thought there be a way to get it to work with a server but not sure how maybe a smart coder could figure it out :/

http://na.leagueofle...d.php?t=1294429

Yeah it's the same files Jabebot uses. And what do you mean exactly when you say "thought there be a way to get it to work with a server"?

  • 0

Could some context be provided on the text file content listed above?

TheFeedski (Now:Bronze, S1:Bronze), RankedSolo5x5: 1254 [0W/0L], Dominion: 2107 [732W/557L], Normal: 624W/570L

Tootulz (Now:Bronze, S1:Bronze), RankedSolo5x5: 1271 [0W/0L], Dominion: 2221 [553W/421L], Normal: 516W/463L

TakinTheHeat (Now:Bronze, S1:Silver), RankedSolo5x5: 1275 [0W/0L], Dominion: 2047 [287W/253L], Normal: 968W/894L

Hugs From Momma, Dominion: 2139 [520W/459L], Normal: 228W/208L

By itself it means little to one who does not play LoL. Also based upon the output it appears to follow the format: (except for the last entry.)


<USER> (Now:<RATING>, S1:<RATING>), RankedSolo5x5: <#> [<#>W/<#>L], Dominion: <#> [<#>W/<#>L], Normal: <#>W/<#>L
[/CODE]

However, the last line does not coincide with the others. Are some information fields optional? To successfully and accurately parse a file, this context and variability must be known.

Once the full format has been identified, parsing the file is easy.

[color=#282828]Alright, then could you expound a bit more on "stick it through PHP" if possible, please? [/color]

Parsing the file is what is meant by stick it through PHP. By which is explained as: PHP opens the file, reads the text in the file, separates the information in the file based upon a specific format (parse), and then generates a table or spreadsheet of the information for display on a webpage.

  • 0

Could some context be provided on the text file content listed above?

By itself it means little to one who does not play LoL. Also based upon the output it appears to follow the format: (except for the last entry.)


<USER> (Now:<RATING>, S1:<RATING>), RankedSolo5x5: <#> [<#>W/<#>L], Dominion: <#> [<#>W/<#>L], Normal: <#>W/<#>L
[/CODE]

However, the last line does not coincide with the others. Are some information fields optional? To successfully and accurately parse a file, this context and variability must be known.

Once the full format has been identified, parsing the file is easy.

Parsing the file is what is meant by stick it through PHP. By which is explained as: PHP opens the file, reads the text in the file, separates the information in the file based upon a specific format (parse), and then generates a table or spreadsheet of the information for display on a webpage.

I can send you the files and then you can know what we i'm talking about.

  • 0

Parsing the file is what is meant by stick it through PHP. By which is explained as: PHP opens the file, reads the text in the file, separates the information in the file based upon a specific format (parse), and then generates a table or spreadsheet of the information for display on a webpage.

I was actualy thinking maybe it could be made automatic though php or another language so the batch file and results.txt wasn't needed. But maybe im wrong and is not possible like i said earlier im still learning php so im unsure.

  • 0

I was actualy thinking maybe it could be made automatic though php or another language so the batch file and results.txt wasn't needed. But maybe im wrong and is not possible like i said earlier im still learning php so im unsure.

Actually, I think it could be made completely automatic through PHP, but it would require much more work and the use of some external PHP libraries (RTMP). However, this library might not have all the desired functionality for this task. The application overall is simple, but I do not have any experience with RTMP in PHP and do not have the time personally to study it. If anyone else wants to try developing a PHP version, I can provide information from the original exe application, but it might be best to ask the author of the original application for assistance first.

I have had a chance to take a quick look at the files and the application and have retrieved the full possible format. I will look into it in more detail sometime later today.

<Variable> - Items inside chevrons, inside strings are variables.

String Generation Logic:


string = "<Name>"

if (RankedSolo5x5-rating not found) {
string += ", "
}
else {
string += " (Now:"

if (RankedSolo5x5-rating < 1249) {
string += "Unranked"
}
else if (RankedSolo5x5-rating < 1399) {
string += "Bronze"
}
else if (RankedSolo5x5-rating < 1519) {
string += "Silver"
}
else if (RankedSolo5x5-rating < 1899) {
string += "Gold"
}
else {
string += "Platinum"
}

string += ", S1:<seasonOneTier>), RankedSolo5x5: "

if (RankedSolo5x5-rating equals 0) {
string += "<1200"
}
else {
string += "<RankedSolo5x5-rating>"
}

string += " [<RankedSolo5x5-wins>W/<RankedSolo5x5-losses>L], "
}

if (OdinUnranked-rating not found) {
string += "Dominion: <OdinUnranked-rating> [<OdinUnranked-wins>W/<OdinUnranked-losses>L], "
}

string += "Normal: <Unranked-wins>W/<Unranked-losses>L"

display string
[/CODE]

Batch file and results txt are quite unneeded, you can run linux code trough your cgi and combine it with php to get it into a mysql database or such

Yes, this most likely could be done instead, but require someone who has the time to make such a cgi script for the OP. Unless the OP knows how to do this themselves, I bet they would accept volunteers for the task.

  • 0

Actually, I think it could be made completely automatic through PHP, but it would require much more work and the use of some external PHP libraries (RTMP). However, this library might not have all the desired functionality for this task. The application overall is simple, but I do not have any experience with RTMP in PHP and do not have the time personally to study it. If anyone else wants to try developing a PHP version, I can provide information from the original exe application, but it might be best to ask the author of the original application for assistance first.

I have had a chance to take a quick look at the files and the application and have retrieved the full possible format. I will look into it in more detail sometime later today.

<Variable> - Items inside chevrons, inside strings are variables.

String Generation Logic:


string = "<Name>"

if (RankedSolo5x5-rating not found) {
string += ", "
}
else {
string += " (Now:"

if (RankedSolo5x5-rating < 1249) {
string += "Unranked"
}
else if (RankedSolo5x5-rating < 1399) {
string += "Bronze"
}
else if (RankedSolo5x5-rating < 1519) {
string += "Silver"
}
else if (RankedSolo5x5-rating < 1899) {
string += "Gold"
}
else {
string += "Platinum"
}

string += ", S1:<seasonOneTier>), RankedSolo5x5: "

if (RankedSolo5x5-rating equals 0) {
string += "<1200"
}
else {
string += "<RankedSolo5x5-rating>"
}

string += " [<RankedSolo5x5-wins>W/<RankedSolo5x5-losses>L], "
}

if (OdinUnranked-rating not found) {
string += "Dominion: <OdinUnranked-rating> [<OdinUnranked-wins>W/<OdinUnranked-losses>L], "
}

string += "Normal: <Unranked-wins>W/<Unranked-losses>L"

display string
[/CODE]

Yes, this most likely could be done instead, but require someone who has the time to make such a cgi script for the OP. Unless the OP knows how to do this themselves, I bet they would accept volunteers for the task.

I have no idea how to do it. So yeah, I would definitely accept volunteers. :p

  • 0

Could some context be provided on the text file content listed above?

By itself it means little to one who does not play LoL. Also based upon the output it appears to follow the format: (except for the last entry.)


<USER> (Now:<RATING>, S1:<RATING>), RankedSolo5x5: <#> [<#>W/<#>L], Dominion: <#> [<#>W/<#>L], Normal: <#>W/<#>L
[/CODE]

However, the last line does not coincide with the others. Are some information fields optional? To successfully and accurately parse a file, this context and variability must be known.

Once the full format has been identified, parsing the file is easy.

Parsing the file is what is meant by stick it through PHP. By which is explained as: PHP opens the file, reads the text in the file, separates the information in the file based upon a specific format (parse), and then generates a table or spreadsheet of the information for display on a webpage.

This is the post you need to be paying attention to. Give us some context... what do the numbers represent? From that a table can be built... what "table" are you actually looking to generate? Based on what numbers now in that .txt file? I.e. what does each row mean in results.txt?

I can send you the files and then you can know what we i'm talking about.

If you mean the same files you sent me, they won't really help... you've already past that stage now. All that's needed now is to parse the results and output them into a table.

I was actualy thinking maybe it could be made automatic though php or another language so the batch file and results.txt wasn't needed. But maybe im wrong and is not possible like i said earlier im still learning php so im unsure.

Batch file and results txt are quite unneeded, you can run linux code trough your cgi and combine it with php to get it into a mysql database or such

The program isn't "Linux code" though. The OP has a Windows-only command-line exectuable file that dumps to a text file. And he doesn't have a Windows server either. How possible Wine is, I don't know... but having the Windows .exe run on a scheduled task on his client PC and then uploading to the server, and PHP taking it from there; seems the easiest option to me.

OP, give us context to the results file!

  • 0

This is the post you need to be paying attention to. Give us some context... what do the numbers represent? From that a table can be built... what "table" are you actually looking to generate? Based on what numbers now in that .txt file? I.e. what does each row mean in results.txt?

Agreed! OP what is the desired result for this information? Storage into a database? Display on a webpage for a LoL clan? Etc...

If you mean the same files you sent me, they won't really help... you've already past that stage now. All that's needed now is to parse the results and output them into a table.

Yes, they were the same files that I presume that you were sent. The application, dlls, and a bat file.

The program isn't "Linux code" though. The OP has a Windows-only command-line exectuable file that dumps to a text file. And he doesn't have a Windows server either. How possible Wine is, I don't know... but having the Windows .exe run on a scheduled task on his client PC and then uploading to the server, and PHP taking it from there; seems the easiest option to me.

Yep, the application is made for windows only, but it could be reverse engineered to create a PHP version of the functionality. That is how I got the string generations logic. However, this is not a polite method of programming, that is why I suggested if someone wanted to create a PHP version that they contact the original author of the program.

Here is a quick and vague rundown of what the windows application does:

1. Create an RTMP connection to a RiotGames server based upon some parameters.

2. Request information from the server about a specified Username.

3. Process the reply and print out some of the results to a file.

This functionality could possibly be replicated entirely in a PHP script, granted that the RTMP PHP library that I listed earlier has all the necessary functionality.

Now, once again I say reverse engineering somebody's work is not polite and should only be used for the advancement and or development around their provided work. This is my viewpoint. Also since the original author would know the logic of their application best, it would make sense to ask them for help and or permission to create a PHP variation.

To sum it all up, I think that a PHP script is much more hassle than its current worth, based upon the information provided. Therefore, it is much wiser in my opinion to just create a PHP script to parse the results generated by the current setup. I have provided the string generation logic that is needed to create a parser for the results file. So once we know what the information needs to be parsed into, then the simple PHP script can be written.

Update:

I forgot to mention in the String Generator Logic that if the User is not found, the resulting output string for that User would be as follows:


"No summoner found for <Username> on <Server Acronym>"
[/CODE]

  • 0

The program isn't "Linux code" though. The OP has a Windows-only command-line exectuable file that dumps to a text file. And he doesn't have a Windows server either. How possible Wine is, I don't know... but having the Windows .exe run on a scheduled task on his client PC and then uploading to the server, and PHP taking it from there; seems the easiest option to me.

OP, give us context to the results file!

When i looked at the code it seemed easily to recode into linux code >.>

  • 0

When i looked at the code it seemed easily to recode into linux code >.>

It's a Windows .exe...?

Ok, just to make sure there is no confusion as to what the program is, does, and what the OP (FunRoomSite) wants; I am going to recap some information and try to explain things as best possible..

Known:

The OP, FunRoomSite, has been given an x86 (32-bit) Windows Application, and a Batch (.bat) file to provide the application with command line parameters.

This application retrieves player stats from League of Legend servers and outputs the results to a text file.

The OP, wants this information available online at a website.

Original Post:

Hey guys, on my site DominateDominion.com I am trying to have a table that updates every day. Basically, I play a game called League of Legends and they have a map called Dominion. There is no ranked mode for dominion, but I was given some files that can get the players elo. I have a note pad where I type in the person's usernamer whos elo I want to find out, then I run a batch file, and open results.txt and it gives the players elo. The guy who gave me the files said all I need for it to update on my site automatically each day was a script where it dumps all the users from the site to a file, runs the batch file, then sends the update back to the server. So how could I do this? I'm don't know any programming or anything at all. Where should I start looking?

Goal:

Have a script that can automatically: Retrieve the stats for each user on a website from a RiotGame server and display those results on the website.

Current Setup:

1. Manually enter the Username(s) into a text file.

2. Run the batch script which calls the Windows application.

3. The Windows application, reads the text file with the username list and retrieves the stats for each user from a RiotGame server.

4. The results are exported to a text file.

5. Per -Alex-'s help, the results text file is uploaded to the OP's website.

Our Options:

A. Create two independent scripts.

1. One PHP script to export the Username(s) from the website to a text file, where the OP must manually or using a scheduled operation execute the batch script and application using the exported list. The results would be uploaded back to the server.

2. The other PHP script to parse the uploaded results and display them on a webpage.

B. Completely rewrite the Windows application (if possible) in PHP and do everything right on the website itself. (Yes this is the nicer option, but much more complex for the developer.)

So OP, FunRoomSite, what say you?

  • 0

Just to add a little to that.. of course you can also have a Cron job setup on the server to export usernames to a text file every x hours, and then get the batch script to first download that text file, instead of using a local one. This is actually an extremely easy thing to do, given that the OP captures users' LoL usernames upon forum signup... something as simple as:

SELECT `pf_lol_username` from `phpbb_profile_fields_data` WHERE `pf_lol_username` != '';

(depending on the OP's table prefix, and how he has named the custom profile field in the phpBB ACP).

  • 0

Just to add a little to that.. of course you can also have a Cron job setup on the server to export usernames to a text file every x hours, and then get the batch script to first download that text file, instead of using a local one. This is actually an extremely easy thing to do, given that the OP captures users' LoL usernames upon forum signup... something as simple as:

SELECT `lol_username` from `forum_users` WHERE `lol_username` != '';

(pseudo-code)

Agreed. Thanks for expanding upon my post.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.