Drow Posted August 13, 2013 Share Posted August 13, 2013 I decided to make a program that checks traffic on rs worlds(for me and m8s just to go looting whenever clans hop) i got it work but the string i get from rs world select page changes every time i dl it so can any1 give me a tip how to mach the correct world with players heres the code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string inf = ",1"; int counter = 0; int[] p = new int[60]; int[] w = new int[60]; int[] vahe = new int[60]; int[] ws = new int[60]; string Players = ""; string World = ""; System.Net.WebClient client = new System.Net.WebClient(); private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); listBox1.Items.Add("World" + " " + "Players"); System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\world.txt"); string world = client.DownloadString("http://oldschool.runescape.com/slu"); sw.Write(world); sw.Close(); System.IO.StreamReader sr = new System.IO.StreamReader("C:\\world.txt"); for (int i = 1; i < 681; i++) { string l = sr.ReadLine(); if (l.Contains(inf)) { Players = l.Substring(29, 3); World = l.Substring(4, 3); Players = Players.Replace(",", ""); counter++; if (Players.Length == 2 && World != "316") { Players = l.Substring(28, 3); Players = Players.Replace(",", ""); } if (World == "317") { Players = l.Substring(30, 3); } if (World == "302") { Players = "1" + Players; } p[counter] = Int16.Parse(Players); listBox1.Items.Add(World + " " + Players); } } sr.Close(); counter = 0; } private void button2_Click(object sender, EventArgs e) { listBox2.Items.Clear(); listBox2.Items.Add("World" + " " + "Players" + " " + "+/-"); System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\world.txt"); string world = client.DownloadString("http://oldschool.runescape.com/slu"); sw.Write(world); sw.Close(); System.IO.StreamReader sr = new System.IO.StreamReader("C:\\world.txt"); for (int i = 1; i < 681; i++) { string l = sr.ReadLine(); if (l.Contains(inf)) { Players = l.Substring(29, 3); World = l.Substring(4, 3); Players = Players.Replace(",", ""); counter++; if (Players.Length == 2 && World != "316") { Players = l.Substring(28, 3); Players = Players.Replace(",", ""); } if (World == "317") { Players = l.Substring(30, 3); } if (World == "302") { Players = "1" + Players; } w[counter] = Int16.Parse(Players); vahe[counter] = (w[counter] - p[counter]); listBox2.Items.Add(World + " " + Players + " " + vahe[counter]); } } sr.Close(); counter = 0; } private void Form1_Load(object sender, EventArgs e) { this.FormBorderStyle = FormBorderStyle.FixedSingle; } } } its sloppy code cuz i wanted to put it together quickly btw is C# Link to comment Share on other sites More sharing options...
Anon Posted August 13, 2013 Share Posted August 13, 2013 Well what string is constantly changing? Also, pretty good code. Link to comment Share on other sites More sharing options...
Drow Posted August 13, 2013 Author Share Posted August 13, 2013 (edited) Well what string is constantly changing? Also, pretty good code. Yes,all the code does is downloading the string getting world and players and then another button download the string again and then compares 2 arrays,but the problem is when i download string again the world in there are in different order example 1st time download w1 w2 w3 2nd w3 w1 w2 Edited August 13, 2013 by Drow Link to comment Share on other sites More sharing options...