Total players online: 7



Take the Tour | Site Map

It is currently Tue Dec 12, 2017 12:41 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Apr 14, 2017 6:45 pm 
Offline
Apprentice Scripter
Apprentice Scripter

Joined: 03/21/2016 20:13
Posts: 10
I KNOW I have to be overlooking this. But I'm just getting back into scripting and cannot for the life of me figure out how to check to see how many items I am currently holding. I am making a tailoring script and want to make items until full and then sell them. Am I just overlooking the variable for it? Or do I need to run it through the #properties? I have searched for this topic but I haven't found anything about it, so that's why I'm thinking I'm just overlooking it.


Top
  Profile 
PostPosted: Fri Apr 14, 2017 6:48 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2123

  1. if #findcnt > 124
  2.   event sysmessage YOU HAVE TOO MANY ITEMS

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Fri Apr 14, 2017 6:51 pm 
Offline
Apprentice Scripter
Apprentice Scripter

Joined: 03/21/2016 20:13
Posts: 10
THANK YOU! I knew it was something simple I was overlooking.

EDIT: I just realized thought, that will only give me the count of the first level. If there are any bags, their contents isn't included.


Top
  Profile 
PostPosted: Sat Apr 15, 2017 12:36 pm 
Offline
Administrator
Administrator
User avatar

Joined: 08/12/2003 07:28
Posts: 18569
Location: Switzerland

You could do a simple Finditem C for all bags, pouches, and so on and then open (use) them and immediately Ignoreitem the ID.
Then when your #FindCNT for the bags is thru, you repeat it: Finditem all the bags (the ones you already opened will be ignored becuase you ignoreitem'd them) and open them...
Repeat until the finditem yields a #findCNT of 0.
Now you have all the bags open.
Ignoreitem reset to find the bags again as they are items as well.
Finditem * C
Display OK I have #FindCNT items in my bags

_________________
EUO Member and postwhore since: 19th Dezember, 2002; Loosing on freeshard Alexandria since: 5th January, 2005
Searches cure for cancer since: 17th November, 2003 on GRID.org & Worldcommunitygrid.org
Made scripts for Project 'Programmers for Alexandria' worth 50$
Image
Quote "mmorning": Where would theses boards be if Orn didn't miss all the sarcasm. Man its great having him here :)
Quote "author-unknown": Good idea. I gotta start doing that too. You're a trendsetter Orn. :)
Quote "dreyfus": #true is always #true


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Sat Apr 15, 2017 12:50 pm 
Offline
Administrator
Administrator
User avatar

Joined: 08/12/2003 07:28
Posts: 18569
Location: Switzerland

I threw something together. 104% untested. May result in a black hole. Dont blame me then... ;)
Code:
  1. ; ==================================
  2. ; Script Name: Demoscript for Bag-opener (recursive or single)
  3. ; Author: Orngrimm
  4. ; Version: 0.01
  5. ; Client Tested with: Tested? Cmon...
  6. ; EUO version tested with: Dream on... Tests... Pft...
  7. ; Shard OSI / FS: Both
  8. ; Revision Date: none
  9. ; Public Release: 15.4.2017
  10. ; Global Variables Used: none
  11. ; Purpose: To explain how to use a untested sub (bag-opener)
  12. ; ==================================
  13.  
  14.  
  15. ; =========== SETUP ================
  16. set %baglist AAA_BBB_CCC_DDD ; All the types of bags, pouches and so on to be opened
  17. ; =========== END SETUP ============
  18.  
  19.  
  20. ; =========== Maincode =============
  21. ; Be sure your backpack is open and no other container with bags and such...
  22. gosub bagopener recursive %baglist
  23.  
  24. ; =========== End Maincode =========
  25. ; This is the code-catcher.
  26. ; Hopefully never executed...
  27. display ok ALERT! Code is falling trough in the maincode!
  28.  
  29.  
  30.  
  31. ; =========== SUBs =================
  32. ; -------------------------
  33. ; Sub name: Bag-opener
  34. ; Autor: Orngrimm
  35. ; Version: 0.01
  36. ; Purpose: To open all the bags in all open containers
  37. ; Params:       %1      req     List of Types to open
  38. ;               %2      req     recursive / single
  39. ; Outputs:      #result         #true = no more bags to open
  40. ;                               #false = maybe more bags to open
  41. ; -------------------------
  42. sub bagopener
  43.  
  44.         {
  45.         if #FindCNT > 0 ; Only do if we have bags
  46.                 {
  47.                 for #FindIndex #FindCNT 1
  48.                         {
  49.                         set !temp #ContID
  50.                         set #lobjectID #FindID
  51.                         event macro 17
  52.                         while #ContID = !temp
  53.                                 {
  54.                                 wait 1
  55.                                 }
  56.                         }
  57.                 }              
  58.         }
  59. until ( %2 = single ) || ( #FindCNT = 0 ) ; Abort if we want a single-run or the recursive-run is finished
  60. if %2 = single && #FindCNT > 0
  61.         set #result #false ; May have more bags to open
  62.  
  63. if %2 = single && #FindCNT = 0
  64.         set #result #true ; Single run, but nothing to open
  65.  
  66. if %2 = recursive && #FindCNT > 0
  67.         set #result #false ; Recursive, but something went wrong: May have more bags to open
  68.  
  69. if %2 = recursive && #FindCNT = 0
  70.         set #result #false ; All bags opened
  71.  
  72.  
  73.  
  74. ;=========== End SUBs =============
  75. ; This is the code-catcher.
  76. ; Hopefully never executed...
  77. display ok ALERT! Code is falling trough in the subs-code!

_________________
EUO Member and postwhore since: 19th Dezember, 2002; Loosing on freeshard Alexandria since: 5th January, 2005
Searches cure for cancer since: 17th November, 2003 on GRID.org & Worldcommunitygrid.org
Made scripts for Project 'Programmers for Alexandria' worth 50$
Image
Quote "mmorning": Where would theses boards be if Orn didn't miss all the sarcasm. Man its great having him here :)
Quote "author-unknown": Good idea. I gotta start doing that too. You're a trendsetter Orn. :)
Quote "dreyfus": #true is always #true


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Sun Apr 16, 2017 5:45 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 12/23/2003 03:27
Posts: 1144
Location: Seige Perilous

Try this:
viewtopic.php?p=126204#126204
its a subroutine, so you have to code it in to be called, but it will read the properties of the backpack and make variables w/ weight and # of items.
the variables are %BWSItems and %BWSWeight
Just tested it on Alexandria and it works well on that server w/ client 7.0.58

_________________
While a = a
{
Scanjournal 1
If Daemon_is_attacking_you in #journal || ( you_are_attacking in #journal && Daemon in #journal )
Terminate UO
}


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Mon Apr 17, 2017 12:18 pm 
Offline
Apprentice Scripter
Apprentice Scripter

Joined: 03/21/2016 20:13
Posts: 10
Thanks guys!

Daemon, that sub works great. Thanks!


Top
  Profile 
PostPosted: Sun May 07, 2017 5:30 am 
Offline
Novice Scripter
Novice Scripter

Joined: 02/04/2017 02:31
Posts: 36
Location: Turkiye
Maybe check the BackPack #property for xxx Items at your chars Paperdoll. It has the exact value for item count

_________________
There is no code that does not work. There is code that does not work as expected...


Top
  ProfileShow poster's scripts in the public script library 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Hosted by CalWeb Internet Services, Inc.