Results 1 to 10 of 10

Thread: Numbers recognition

  1. #1
    Join Date
    Jun 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Numbers recognition

    I am curently writing my first script, and came up with the problem described below. Please do not go offtopic by discussing the scripts idea, security etc..

    This script should accept trade, check the amount of noted items offered by other player, multiply that amount by the price of that item and give the amount of money. The only problem is that i don't know how to get the amount of items that i'm buyng, i need it to recognize the number of notes.

    Any ideas?

  2. #2
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Ahh. This same, old, terrible question.

    Perhaps:

    SCAR Code:
    {*******************************************************************************
    function GetAmount(itemx, itemy: Integer): Integer;
    By: masquerader || Improved by Freddy1990 ||Updated June 4 2007 by Boreas
    Description: Returns the ammount of an item at a certain position.
    *******************************************************************************}


    function GetAmount(itemx, itemy: Integer): Integer;
    //uses font cropped to work with "Opponent's Offer"
    //coords are same as ones from istextinarea, but
    //you probably shouldnt use this function directly (others use it)
    //'K' and 'M' work (for approx values)
    //non-stackable =1
    //blank = 0
    var
      amountstr: string;
      tempx, tempy, color: Integer;
    begin
      if findcolor(tempx, tempy, 65535, itemx, itemy, itemx + 10, itemy + 10) then
        color := 65535;
      if color = 0 then
        if findcolor(tempx, tempy, 16777215, itemx, itemy, itemx + 10, itemy + 10) then
          color := 16777215;
      if color = 0 then
        if findcolor(tempx, tempy, 8453888, itemx, itemy, itemx + 10, itemy + 10) then
          color := 8453888;
      amountstr := Trim(GetTextAtEx(itemx + 1, itemy + 3, 0, tradeChars, False, False,
        0, 2, color, 5, True, tr_AlphaNumericChars));
      if (Length(amountstr) > 0) then
      begin
        if (Pos('K', amountstr) > 0) then
        begin
          Delete(amountstr, Length(amountstr), Length(amountstr));
          Result := StrToInt(amountstr) * 1000;
        end else
          if (Pos('M', amountstr) > 0) then
          begin
            Delete(amountstr, Length(amountstr), Length(amountstr));
            Result := StrToInt(amountstr) * 1000000;
          end else
            Result := StrToInt(amountstr);
      end else
        if (FindColor(tempx, tempy, 65536, itemx, itemy, itemx + 30, itemy + 30)) then
          Result := 1;
    end;
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  3. #3
    Join Date
    Jun 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hm.. looks like i'm to new at scripting to find this useful

  4. #4
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    To be honest, there's a bit of code I don't understand either
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  5. #5
    Join Date
    Jun 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well at least i tried to write somthing myself.. but now i think this is the end of my script

  6. #6
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Whoa! No! Don't give up!
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  7. #7
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    just look in Misc\Amount.scar

    Keep on looking till you understand it. And if you don't, just use it until you understand it! lol

  8. #8
    Join Date
    Oct 2006
    Posts
    1,071
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Don't give up just because you don't understand! Think how cool you'll feel when it works and you realize you do get it

  9. #9
    Join Date
    Jun 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you know.. i didn't and now.. with some help from my friend i think i will make it!

  10. #10
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Redownload SRL from Divi file menu, as that one posted above needs to be updated.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 10
    Last Post: 05-17-2009, 10:23 PM
  2. How to get numbers???
    By RusinaRange in forum OSR Help
    Replies: 1
    Last Post: 12-05-2007, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •