Results 1 to 12 of 12

Thread: counting inventory items

  1. #1
    Join Date
    Oct 2007
    Location
    england
    Posts
    200
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default counting inventory items

    hi i know how to count inv items but i dont know how to count the ammout of a spasific item e.g.

    if you were cutting yews and like you got a sandwich from the sand wich lady
    how would you tell the script just to count the yew logs??

    please help
    Quote Originally Posted by ham? View Post
    i didnt merder the fukin english language it im just talkin gangsta!!
    which none of u would no coz ur all fukin nerds

  2. #2
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Make a DTM of the yew logs, and use CountItems(YourDTM,DTM,sometolerancenumber);

  3. #3
    Join Date
    Oct 2007
    Location
    england
    Posts
    200
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    so then in proggie how would i say howmany logs gained
    Quote Originally Posted by ham? View Post
    i didnt merder the fukin english language it im just talkin gangsta!!
    which none of u would no coz ur all fukin nerds

  4. #4
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Lets say you're storing the value in the variable called Logs. You'd use something like this in the main part of your script:
    SCAR Code:
    Logs:= Logs + CountItems(YourDTM,DTM,5);
    And something like this for the proggy:
    SCAR Code:
    Writeln('Cut ' + IntToStr(Logs) + ' logs!');

  5. #5
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    Lets say you're storing the value in the variable called Logs. You'd use something like this in the main part of your script:
    SCAR Code:
    Logs:= Logs + CountItems(YourDTM,DTM,5);
    And something like this for the proggy:
    SCAR Code:
    Writeln('Cut ' + IntToStr(Logs) + ' logs!');
    You also have to say its in inventory, this is directly from my script:

    SCAR Code:
    LogDTM := DTMFromString('78DA639CCEC4C0C0C9C80002AC0C10E06A27C' +
           '12002A441A2FF8180B18F09CA43068C4824909E0354F39701BF9A' +
           '8540350204CC990854234A404D3B500D2F01354B816AB8F0AB010' +
           '0353C0A3A');
      LogsCut := ItemAmount('inv', 'dtm', LogDTM, []);
      TotalLogs:= (TotalLogs + LogsCut);

    TotalLogs + LogsCut will count how many logs your chopped before you last banked + the logs you've banked since the script started, it wont count items already in the bank.

    SCAR Code:
    WriteLn(Padr('|| Logs Chopped: ' + IntToStr(TotalLogs), 67) + '||');

  6. #6
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by D1zl3 View Post
    You also have to say its in inventory, this is directly from my script:

    SCAR Code:
    LogDTM := DTMFromString('78DA639CCEC4C0C0C9C80002AC0C10E06A27C' +
           '12002A441A2FF8180B18F09CA43068C4824909E0354F39701BF9A' +
           '8540350204CC990854234A404D3B500D2F01354B816AB8F0AB010' +
           '0353C0A3A');
      LogsCut := ItemAmount('inv', 'dtm', LogDTM, []);
      TotalLogs:= (TotalLogs + LogsCut);

    TotalLogs + LogsCut will count how many logs your chopped before you last banked + the logs you've banked since the script started, it wont count items already in the bank.

    SCAR Code:
    WriteLn(Padr('|| Logs Chopped: ' + IntToStr(TotalLogs), 67) + '||');
    No you don't. You're using ItemAmount. I was using CountItems. CountItems only works on things in your inventory, and only works well with nonstackable items.

  7. #7
    Join Date
    Oct 2007
    Location
    england
    Posts
    200
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey thanks for your help will use and tell u if works for me
    Quote Originally Posted by ham? View Post
    i didnt merder the fukin english language it im just talkin gangsta!!
    which none of u would no coz ur all fukin nerds

  8. #8
    Join Date
    Dec 2008
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey i needed this two... Dizl3's way worked for me thanks! When i tryed senrath's way it came up with an error where you wrote (Yourdtm,DTM,5)
    for 'yourDTM' i put the name of my dtm
    for DTM i just left DTM there -(should i have changed to somthing?)
    and for 5 i just left as 5 tol
    it said somthing like unknown identerfire DTM i tryed adding it to var but still didnt work

    any suggestions

  9. #9
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Sorry, I meant to put 'DTM'. You need the ''.

  10. #10
    Join Date
    Dec 2008
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    Sorry, I meant to put 'DTM'. You need the ''.
    sorry i still dont get what you mean buy that??

  11. #11
    Join Date
    Jun 2008
    Location
    Great Britain
    Posts
    185
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by ham? View Post
    sorry i still dont get what you mean buy that??
    It's 'by', and he means putting inverted commas around it.
    "The enemy of my enemy is next!"~Lord Solar Macharius
    "When the power of love overcomes the love of power the world will know peace" ~Jimi Hendrix

    Use the spell-checker before you post!

    http://www.srl-forums.com/forum/begi...sh-t42131.html

    ^Beginners guide to English (READ IT!)

  12. #12
    Join Date
    Oct 2007
    Location
    england
    Posts
    200
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    o rite ty
    Quote Originally Posted by ham? View Post
    i didnt merder the fukin english language it im just talkin gangsta!!
    which none of u would no coz ur all fukin nerds

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Counting items in inventory?
    By yargo in forum OSR Help
    Replies: 7
    Last Post: 08-14-2008, 05:54 PM
  2. Counting Items
    By smithsps in forum OSR Help
    Replies: 8
    Last Post: 05-15-2008, 12:42 AM
  3. Items in inventory help
    By wtf i sp4nk in forum OSR Help
    Replies: 2
    Last Post: 05-20-2007, 09:58 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
  •