Jump to content

Delscid

Members
  • Posts

    23
  • Joined

  • Last visited

Reputation

0 Neutral

About Delscid

  • Birthday 11/13/1994

Profile Information

  • Gender
    Male
  • Location
    New Zealand

RuneScape Information

  1. EDIT: Fixed (sorry for the bad post formatting and generally bad code, was just a quick test to see if it worked, will refactor once I actually get it working) I'm working on a little personal project, which is an OCR-driven drop log for Runescape (This never actually interacts with the Runescape client in any way, no input) It's supposed to work by taking a screenshot of the Runescape client, finding any item text (which is done by itterating through each pixel and checking if it matches the item text colour, then converting the result to a pattern) and using OCR to turn this into a string (not the best method for this, but again, to test). To do this, I'm using patterns of each character in the Runescape font stored with the format: (Pattern being a boolean representation of each pixel in the image used to generate the pattern, non-white: true, white: false) And itterating over each pixel in the input image and looking for sequences that match the first part of a pattern, then repeating this for the pixels below the matched sequence until there is a part which does not match, or until the pattern is fully matched (yes, I know this is horribly inefficient and I have briefly looked at other OCR libraries, most of the ones which have the features I need have memory leak issues though). Currently, its only a test to make sure I can actually read text. One part of the code which searches for a matching sequence is giving an odd bug which I can't find the source of anywhere... GetCharacters: private char[] GetCharacters(bool[] value, SearchPattern[] patterns) { List<char> characters = new List<char>(); // Itterate over each pixel in the input image sequence. for (int i = 0; i < value.Length; i++) { foreach (SearchPattern p in patterns) { // Check if there is a match for the first line of the search pattern. if (p.IsMatch(0, value.Skip(i).Take(p.Lines[0].Length).ToArray())) // <-- Line where it fails. { // Check each line of the pattern for a match. for (int l = 1; l < p.Height; l++) { int offset = 0; bool isMatch = p.IsMatch(l, value.Skip(i + offset + (loadedImage.Width - p.Width)).Take(p.Lines[l].Length).ToArray()); // <-- May fail if (isMatch && l == p.Height - 1) { characters.Add(p.Character); break; } else if (isMatch) { offset += (loadedImage.Width - p.Width); } else { break; } } } } } return characters.ToArray(); } The call p.IsMatch(0, value.Skip(i).Take(p.Lines[0].Length).ToArray()) always fails because of the bug in SearchPattern.IsMatch loadedImage being a Bitmap object representing the input image. Skip and Take provided by LINQ. SearchPattern.cs using System.IO; using System; namespace RunescapeOcr { public class SearchPattern { public SearchPattern(string path) { using (BinaryReader reader = new BinaryReader(File.OpenRead(path))) { this.Character = reader.ReadChar(); this.Width = reader.ReadInt32(); this.Height = reader.ReadInt32(); int sequenceLength = (int)reader.BaseStream.Length - (int)reader.BaseStream.Position; this.Sequence = new bool[sequenceLength]; for (int i = 0; i < sequenceLength; i++) { this.Sequence[i] = reader.ReadBoolean(); } this.Lines = GetLines(Width, Height, Sequence); } } public bool IsMatch(int line, bool[] sequence) { // BUG: This check always fails no matter what I change. // For the test, this.Lines[line].Length is 5 (only characters used are both 5 pixels wide) // However, even though this.Lines[line].Length is used to select characters in GetCharacters, // it always ends up being with sequence.Length being 4 (for this test). // if I add 1 to this to get them to match, sequence.Length becomes 5, so the result ends up being 6 instead. // I've tried several other things (different operators (e.g. <, >, <=, >=, == etc.)) // but this condition will always change so that it throws an exception. if (this.Lines[line].Length != sequence.Length) throw new Exception("Sequence lengths do not match"); for (int i = 0; i < this.Lines[line].Length; i++) { if (this.Lines[line][i] != sequence[i]) return false; } return true; } protected bool[][] GetLines(int width, int height, bool[] sequence) { if ((sequence.Length / width) != height) throw new Exception("Corrupted Search Pattern."); bool[][] lines = new bool[height][]; for (int h = 0; h < height; h++) { lines[h] = new bool[width]; for (int w = 0; w < width; w++) { lines[h][w] = sequence[(h * width) + w]; } } return lines; } public char Character { get; private set; } public int Width { get; private set; } public int Height { get; private set; } public bool[] Sequence { get; private set; } public bool[][] Lines { get; private set; } } } I really can't see what is causing this bug... it always happens and seems to change dynamically to any adjustments I make.
  2. oh, ok, not sure what it could be then.
  3. I had problems similar to those when I tried modding minecraft before(wouldn't go past the update screen). For some reason, it doesn't like IZArc (assumed you used it from previous post). I would try using something like WinRAR or 7zip, it seems to get along with those fine.
  4. I have been looking at different languages for GUI programming which I would use for several projects I mainly did GUI programming in C# due to .NET making it incredibly easy, but I want to try to do more cross-platform work I've looked briefly at a few of the cross platform languages, but I was wondering what the best is. I would prefer to steer away from languages would need the user to download some other platform for it to run e.g Java(I know most people would have Java already), Python(haven't really looked into Python much, but from my experience you need to download Python to run programs). I don't really mind learning a new language if it would help with this. at the moment, C++ looks like the best choice, but I would still like an opinion on what the best choice would be or on anything I may have missed.
  5. ok, no problem just an after-thought, you could use the adventurers log to check and fill in most blanks from the highscores, it would be a wasted request though if the person wasn't a member.
  6. Looks good, could be useful for the runescape client im trying to build. If you want any help with putting the results into a class structure instead of arrays and lists, I could try to throw something together for you? e.g: HighscoreResult result = RSapi.Highscores.getPlayerStats("username"); Console.WriteLine(result.Skills.Overall.Level); instead of List<string> result = RSapi.Highscores.getPlayerStats("username"); Console.WriteLine(result[0].split(',')[1]);
  7. Happy birthday :D

  8. Happy birthday!

  9. has not set their status

  10. Very nice. Its alot better than my account and ive played for about the same time 8/10
  11. [hide=][x] Became a Member Quests [x] Barrows Gloves [x] Ancient Spells Unlocked [x] Lunar Spells unlocked [x] Been inside the Death Altar before [x] 100+ Tears in Tears of Guthix [x] All Quests Completed Champion Challenges [ ] Obtained a Champion Challenge Scroll [imp] [x] Obtained a Champion Challenge Scroll [Goblins] [ ] Obtained a Champion Challenge Scroll [skeletons] [x] Obtained a Champion Challenge Scroll [Zombies] [ ] Obtained a Champion Challenge Scroll [Giants] [ ] Obtained a Champion Challenge Scroll [Hobgoblins] [ ] Obtained a Champion Challenge Scroll [Ghouls] [ ] Obtained a Champion Challenge Scroll [Earth Warriors] [ ] Obtained a Champion Challenge Scroll [Jogres] [ ] Obtained a Champion Challenge Scroll [Demons] [ ] Defeated The Champion of Champions Mini-Games [ ] Pharoahs Sceptre from Pyramid Plunder [ ] Guthan Spear from Barrows Minigame [ ] Phasmatys Flag from Trouble Brewing [x] Fight Caves Completed [ ] 4000 Chompy kills [x] Finished the Rogues Den Maze [x] Any Void Knight Piece of Clothing/Guthix Mace [ ] Gold Castle Wars Armor Piece [ ] Robin Hood Hat from Treasure Trails [x] Manta Ray from Trawler [x] Sea Turtle from Trawler [ ] Maximum Mage Training Arena Points [Orangish Hat] [x] Completed Stronghold of Security [x] Won a game of Fight Pits with 20+ people [x] Bones to Peaches Unlocked [x] Completed Mage Arena with at least one god spell Guilds [x] Mining Guild Access [x] Legends Guild Access [x] Fishing Guild Access [x] Champions Guild Access [x] Warriors Guild Access [x] Heroes Guild Access [x] Rangers Guild Access [x] Magic Guild Access [x] Cooking Guild Access [x] Crafting Guild Access [x] Prayer Guild Access [x] Rune Defender [x] Perfect Score in Rangers Guild Minigame Monster Drops [ ] Dragon Chain from Kalphite Queen/Dust Devils [ ] D2H from Chaos Elemental [x] Dragon Axe from Dagganoth Kings [x] Warrior Ring from Dagganoth Rex [x] Beserker Ring from Dagganoth Rex [x] Mud staff from Dagganoth Prime [x] Seers Ring from Dagganoth Prime [x] Seercull from Dagganoth Supreme [x] Archers Ring from Dagganoth Supreme [x] Dragon Shield Left Half Drop [x] Abyssal Whip Drop from Abyssal Demons [x] Dragon Legs/Skirt from Metal Dragons Games Room [ ] 1500+ Rating in Runelink [ ] 1500+ Rating in Draughts [ ] 1500+ Rating in Runeversi [ ] 1500+ Rating in Runesquares Player-Owned Houses [x] Sat on a demonic throne [x] Got trapped in a Greater Magic Cage [x] Used a Scrying Pool [ ] Mounted Fish from fishing [x] Mounted Head from any monster Moderators [x] Seen a Jagex Mod [ ] Became A Player Moderator [ ] Been muted by a player mod Random Events [x] Full Mime [x] Full Camo [x] Full Zombie [x] Full Lederhosen [ ] Spirit Seed [x] Any Bird Egg Skill Related [ ] Top 10k in every skill [x] 100+ Combat [x] 126 Combat [ ] 200m xp in a skill [x] 99 in one skill Seasonal Items, Retired or not [ ] Own/Owned a Party Hat [ ] Own a Scythe [ ] Own a Rubber Chicken [ ] Own a Yo-yo Miscellanious [x] Unlocked Dragonstone Chest in Taverly [x] 180k Crystal Bows [x] Burned a Fiyr Shade [x] Obtained a Wiley/Lazy Cat [x] Finished the Lava Maze [ ] White Knight Master [1600 kills] [x] Obtained Skull Sceptre [ ] Own a pair of bunny ears [x] Every Monkey Greegree [ ] 2.1B cash [x] Own all three completed prayer books [x] All Musics Unlocked [x] All Emotes Unlocked[/hide]
  12. It was a painfully long fight but I killed it took 2 hours and 15 mins *made the dagger and sold drops for the bone dagger *fished sharks for food *made a prayer pot from a random ranarr I got
  13. I can just see some guy sitting at his desk laughing his but off at people panicking over conficker, either that or someone at Microsoft got drunk and made it. :?
  14. With this quote... we could be wandering around aimlessly like blind chickens waiting for any news I sort of like the concept of surprise updates but still I miss the bts :cry: :cry:
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.