Author Topic: TrailMyx's Item Paperdoll/Container Durability Checker  (Read 12417 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
TrailMyx's Item Paperdoll/Container Durability Checker
« on: June 09, 2008, 12:56:16 PM »
+1
Code: [Select]
;-----------------------------------------------------------
; Script Name: TrainMyx's Item Paperdoll/Container Durability Checker
; Author: TrailMyx
; Version: 1.0
; Client Tested with: 6.0.1.6
; EUO version tested with: 1.5 118
; Shard: OSI, FS(?)
; Revision Date:  6/15/2007
; Public Release: ...
; Global Variables Used: None
; Purpose/Features:
;   . Scan paperdoll (or targeted container when you set %scan_container to #TRUE) to generate
;   a repair report.
;   . Change value of %warning_percentage to change your repair threshold
;-------------------------------------------------------

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
tool_check_durability1.txt
« Last Edit: June 09, 2008, 09:56:15 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: TrailMyx's Item Paperdoll/Container Durability Checker
« Reply #1 on: May 31, 2021, 10:01:53 AM »
0
TM,
First, I GOTTA point out the typo in your name in the script header! :police: :laugh:
Second, I am trying to implement this sub into a project. I have
Code: [Select]
gosub TM_CheckCurrentDurabilityin my setup loop.
I put a 0 durability item on and ran it, no notification of low durability. I put a display check in after the gosub, and got N/A as #result. I KNOW I am messing something up. :-\\

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Item Paperdoll/Container Durability Checker
« Reply #2 on: June 01, 2021, 08:31:42 AM »
0
I like Trains as much as I like Trails!  So it's ok.

As for the script, you might want to put a pause at the beginning of execution and step through to see where it's going wonky.  I really have no scripting setup I can test with these days, so I'm blind and will need your eyes to see.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: TrailMyx's Item Paperdoll/Container Durability Checker
« Reply #3 on: June 02, 2021, 05:59:26 AM »
0
It looks like there is no loop for the paperdoll. So it never scans it. there is mainloop one for the container. It opens the paperdoll and that is it. Would something like this work?:
Code: [Select]
finditem * C_ , #charid
for #findindex 1 #findcount
{
event property #findid
[i]tm magic happens here[/i]
}

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Item Paperdoll/Container Durability Checker
« Reply #4 on: June 02, 2021, 08:57:24 AM »
0
That could work for sure.  Here's the sub I lifted out of the FAF that manages that horrible moment when your armor pieces start falling off and suddenly your LRC is no longer 100%.  :)

Code: easyuo
  1. ;-------------------------------------------------------------------------------
  2. ; %1 - percentage left from max.  CURRENT/MAX
  3. ; %2 - #TRUE, display warn
  4. sub CheckItemDurability
  5.   namespace push
  6.   namespace local CID
  7.   set !temp_LPC #LPC
  8.   set #LPC 1000
  9.   set !warning_percentage %1
  10.   set !displaywarning %2
  11.   set !result #FALSE
  12.   set !warnstring
  13.   finditem * C_ , #CHARID
  14.  
  15.   for #FINDINDEX 1 #FINDCNT
  16.   {
  17.     set !item #FINDID
  18.     event property !item
  19.     set !searchfor Durability , #SPC
  20.     if !searchfor in #PROPERTY
  21.     {
  22.       gosub TM_CheckMaxDurability !item
  23.       set !max #RESULT
  24.       gosub TM_CheckCurrentDurability !item
  25.       set !current #RESULT
  26.       gosub TM_GetItemName !item
  27.       if #RESULT <> #TRUE
  28.       {
  29.         set !name #RESULT
  30.         set !percent !current * 100 / !max
  31.         if !percent <= !warning_percentage
  32.         {
  33.           set !warnstring !warnstring , !name , : , #SPC , !current , / , !max , $
  34.           set !result #TRUE
  35.         }
  36.       }
  37.     }
  38.   }
  39.   if !result = #TRUE && !displaywarning = #TRUE
  40.   {
  41.     display ok Repair scan summary: , $ , $ , !warnstring
  42.   }
  43.   set #LPC !temp_LPC
  44.   set #RESULT !result
  45.   namespace pop
  46. return #RESULT
  47.  

Called using this where the warning if 5% of maximum and will display a warning (#TRUE) and returns #TRUE if anything matches this criterion.

Code: easyuo
  1. gosub CheckItemDurability 5 #TRUE
  2.  
« Last Edit: June 02, 2021, 09:00:09 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: TrailMyx's Item Paperdoll/Container Durability Checker
« Reply #5 on: June 02, 2021, 09:07:19 AM »
0
Thanks TM. I'm going to be using this in a released script. May I put the loop into your sub as mainloop2? Also, I was wondering if you had any tips on how I might best:
1) go to mainloop2 from my mainloop
2) how best to get the #result to my mainloop?

I am always reluctant to modify others' subs, so I am not sure if I could just set a %var for the #result and grab that from the main.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Item Paperdoll/Container Durability Checker
« Reply #6 on: June 02, 2021, 10:29:13 AM »
0
From what it sounds like, you should just use this sub from the FAF that I posted.  That way you don't have to content with a "goto" and you can use the #RESULT.  Just call it with:

Code: easyuo
  1. gosub CheckItemDurability 5 #FALSE
  2.  

Doing this, the sub itself won't warn you but it will return #TRUE stating that something on the paperdoll is less than 5% (or whatever percentage you want to put there).  Other scripts I put that value at 80% just to give me warning that it's time to repair.

oh, also keep in mind that the above sub uses a couple other subs that I think are the same from this script snippet for Durability, but here they are to be complete:

Code: easyuo
  1. ;-------------------------------------------------------
  2. ; %1 = #FINDID of item to evaluate
  3. sub TM_CheckCurrentDurability
  4.   namespace push
  5.   namespace local CMD
  6.   set !item %1
  7.   event property !item
  8.   set !property #PROPERTY
  9.   set !search Durability , #SPC
  10.   str count !property !search
  11.   if #STRRES > 1
  12.   {
  13.     str pos !property !search #STRRES
  14.     set #STRRES #STRRES - 1
  15.     str del !property 1 #STRRES
  16.     set !property #STRRES
  17.   }
  18.   str pos !property !search 1
  19.   set #STRRES #STRRES + 10
  20.   str del !property 1 #STRRES ; 87 / 87$
  21.   set !temp #STRRES
  22.   str pos #STRRES / 1
  23.   set #STRRES #STRRES - 2
  24.   str left !temp #STRRES
  25.   set #RESULT #STRRES
  26.   namespace pop
  27. return #RESULT
  28. ;-------------------------------------------------------
  29. ; %1 = #FINDID of item to evaluate
  30. sub TM_CheckMaxDurability
  31.   namespace push
  32.   namespace local CCD
  33.   set !item %1
  34.   event property !item
  35.   set !property #PROPERTY
  36.   set !search Durability , #SPC
  37.   str count !property !search
  38.   if #STRRES > 1
  39.   {
  40.     str pos !property !search #STRRES
  41.     set #STRRES #STRRES - 1
  42.     str del !property 1 #STRRES
  43.     set !property #STRRES
  44.   }
  45.   str pos !property !search 1
  46.   set #STRRES #STRRES + 10
  47.   str del !property 1 #STRRES ; 87 / 87$
  48.   set !temp #STRRES
  49.   str pos #STRRES / 1
  50.   str del !temp 1 #STRRES
  51.   set !temp #STRRES
  52.   str pos #STRRES $ 1
  53.   set #STRRES #STRRES - 1
  54.   str left !temp #STRRES
  55.   set #RESULT #STRRES
  56.   namespace pop
  57. return #RESULT
  58.  
« Last Edit: June 02, 2021, 10:33:18 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!