Author Topic:  (Read 5610 times)

0 Members and 1 Guest are viewing this topic.

Offline rana70Topic starter

  • Elite
  • *
  • *
  • Posts: 294
  • Activity:
    0%
  • Reputation Power: 5
  • rana70 has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 2
    • View Profile
    • MyScripts
« on: October 31, 2011, 09:03:17 AM »
0
Rana's Weight Handling SUBs for Chars, Backpacks and Containers

Code: [Select]
;==========================================================================================
; Script Name: Rana's Weight Handling SUBs
; Author: Rana
; Version: Check %Ver
; Client Tested with: 7.0.19.x
; EUO version tested with: 1.5 (Build 202)
; Shard OSI / FS: OSI
; Revision Date: 10/31/2011
; Public Release: 07/10/2008
;==========================================================================================

Purpose
SUB Routines to handle all type of weight issues and
also provide the amount of Items within a given Container.
The maximum load limit of the Char is calculated by its strength and race.

There are a set of variables you can use within your own script
to manage all your weight and item needs eg prevent from
overload or prevent from overfill Containers, detect changes
in weight or items amounts to update your display.



SETUP
I recommand to do this line as a part of your Script header !!!!!
GoSUB RANA_CharWeightHandling INIT

GoSUB RANA_CharWeightHandling [INIT]
    OPTION: INIT
            Prepair Data for propper Weight calculations
            The SUB has to run at least ones with the INIT parameter
            before you can use it again in the script. The INIT part
            will make sure you get propper data by open up Paperdoll,
            Statusbar and figure out your Char and Server related limits.

How-to-Use


The two SUBs will give you all the data you might need:

GoSUB RANA_CharWeightHandling [INIT]
#RESULT   returns ->
           OK (no change in values, no errors) or
           ERROR (something messed up, invalid results) or
           UPDATE (a change in value since last check, you might initiate a redraw (Flickerprevention))

%RANA_WH_RACE                  -> HUMAN / ELF / GARGOYLE
%RANA_WH_ServerTypeSP          -> #TRUE Server uses Siege Perilous ruleset eg. no recall
%RANA_WH_ServerName            -> Just the Name of the actual Shard
%RANA_WH_ServerType            -> Type of ruleset REGULAR -> OSI PROD Shard / OSI SP -> Siege P.
%RANA_WH_MaxFreeBackPackStones -> Max. amount of stones before your Char is overweighted
%RANA_WH_MaxFreeBackPackItems  -> Max. amount of items your Backpack can hold


GoSUB RANA_ContainerCheck [ContainerID]
#RESULT returns ->
         ERROR (invalid Container or something messed up) or
         0-124 (amount of Items within the Container) or
         FULL (no more room in the Container)

%RANA_WH_ContainerItems  -> amount of items within the checked Container
%RANA_WH_ContainerFull   -> #TRUE Container holds 125 Items / #FALSE holds less than 125 Items


History
Version 1.20
 ADD ContainerCheck more Failsafe (Restore last #FindID)
Version 1.10
 ADD Gargoyle Race

There are 2 attachment(s) in this post. You must register and post an acceptable introduction to download
SUB Weight Handling 1.2.EUO
tryit for SUB Weight Handling 1.2.EUO

Offline ErwinEUO

  • Jr. Member
  • **
  • Posts: 17
  • Activity:
    0%
  • Reputation Power: 1
  • ErwinEUO has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
« Reply #1 on: October 26, 2017, 08:27:02 PM »
0
Hi There,

Thanks so much for this sub, it was very useful to me.

I made one small change because the init option gave inconsistent results immediately after a recall that crossed server lines:

Original Code:
Code: easyuo
  1.    
  2. FindItem #CHARID *
  3.    if #FindType in HS_IS
  4.       Set %RANA_WH_RACE HUMAN
  5.    if #FindType in XU_AV
  6.       Set %RANA_WH_RACE ELF
  7.    if  #FindType in OCB_NCB
  8.       Set %RANA_WH_RACE GARGOYLE
  9.  

Changed Code:
Code: easyuo
  1. if #CHARTYPE in HS_IS
  2.    Set %RANA_WH_RACE HUMAN
  3. if #CHARTYPE in XU_AV
  4.    Set %RANA_WH_RACE ELF
  5. if  #CHARTYPE in OCB_NCB
  6.    Set %RANA_WH_RACE GARGOYLE
  7.  

Thanks again!

EE