• 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.
  • Posts

    • YouTube has finally brought back its DMs feature, but only in these countries by David Uzondu Late last year, YouTube started testing a "new" way to share videos directly with friends, without having to leave the app. Now, the video giant has announced that is now rolling out a revamped direct messaging inbox, which lets you share videos, Shorts, and live streams and have conversations about them, directly on YouTube. The platform limits this feature to 18+ users who are signed in to a verified channel and use the latest mobile app version. Direct messaging on YouTube first became a thing back in 2017 inside the mobile app (later renamed to "Messages"), where users could chat one-on-one and share clips directly, but all that came to an end on September 18, 2019, when Google decided to shut it down after giving users a month to download a .zip file archive of their past chats. No one really knows why YouTube killed the feature, but users were encouraged to migrate to the public Comments section, on Community tab posts, and via YouTube Stories. The previous incarnation suffered from moderation challenges, prompting Google to implement stricter safety guidelines and age verifications for this new iteration. Here's a list of the countries where the re-launched feature is currently available, though note that Brand Accounts do not have access to it, at least for now: Countries American Samoa Austria Belgium Brazil Bulgaria Croatia Cyprus Czech Republic Denmark Estonia Finland France Germany Greece Guam Hungary Iceland Ireland Italy Latvia Liechtenstein Lithuania Luxembourg Malta Netherlands Northern Mariana Islands Norway Poland Portugal Puerto Rico Romania Singapore Slovakia Slovenia Spain Sweden Switzerland U.S. Virgin Islands United Kingdom United States Before you can use the feature, you first have to send an invite link to your contact. Invite links expire exactly seven days after you create them. If the person on the other end accepts the invite, you can exchange videos directly and text back and forth inside the app. To delete a message, just long-press on the message and tap unsend to remove it for both users. You can also delete entire conversations by long-pressing the thread and selecting delete, but the other person will continue to see the chat history on their end. To make sure everything remains safe, YouTube monitors these messages to ensure they follow Community Guidelines.
    • The problem of course is simply that government does not always know best. My point is that agency is taken away from the EU consumer in these cases. I'm sorry, but I do not believe that governments (politicians) are inherently good, and "looking out for me." Primarily they look to themselves and their own personal desires first, foremost, and always. When the EU or the DOJ fines these companies, claiming to "represent the welfare of the consumer," how much of these billion-dollar judgments are handed to the consumers they claim to represent? Not even a dollar, as I've seen. Yet the EUC lawyers who are paid to sit around and dream up these suits make huge commissions on the fines the EUC adjudicates, which is an ironclad fact I hope everyone is aware of. It's also rank corruption, of course, but that's another topic. Last, when the EU inflicts these judgments, or the DOJ, take your pick, the costs are bundled right along in the cost of the goods and services these companies provide the consumers they are "looking out for." If you are someone who believes his government is his savior then you have my condolences. I think Apple is right here, because the whole scheme of consumer choice is that consumers pick and choose among the products companies offer. Microsoft Windows is more compatible with third party software and hardware than any desktop OS on Earth, which is my sole reason for choosing it. Just because the EUC forces companies do certain things it knows the companies do not want to do, "or else", has no bearing on consumer benefit. This Siri thing is almost idiotic it's so infantile. But this is what the EUC does when the EU in Brussels becomes cash-strapped and needs a big infusion of cash. Some people get upset by "big companies" but it's the opposite when governments dwarf the size and scope of these companies, which is so obvious it hurts.... I mean you can't honestly believe that forcing Apple to do things with Siri it has its own reasons to decline is something that "opens up" Apple, do you? Say it aint' so...
    • Looks like many years since the request was made, a directory tree view finally may be added. https://github.com/files-community/Files/pull/18537
    • Is it still super slow or has it improved on that area?
    • There's this from last year https://gist.github.com/threat...364659a8887841aa43deca4efd9 but nothing about a buffer overflow that MS somehow can't code against. No matter what, it makes sense to take a "protected by default" approach.
  • Recent Achievements

    • One Month Later
      sjbousquet earned a badge
      One Month Later
    • Week One Done
      sjbousquet earned a badge
      Week One Done
    • First Post
      DragonOfMercy earned a badge
      First Post
    • First Post
      bella52 earned a badge
      First Post
    • Reacting Well
      Techinmay earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      501
    2. 2
      PsYcHoKiLLa
      214
    3. 3
      +Edouard
      156
    4. 4
      Steven P.
      84
    5. 5
      FloatingFatMan
      73
  • Tell a friend

    Love Neowin? Tell a friend!