Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006145opensim[REGION] Scripting Enginepublic2012-08-09 16:262012-08-23 23:24
ReporterTBG Renfold 
Assigned Tojustincc 
PrioritynoneSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0006145: Patch to add osGetHealth.
DescriptionSaw this post on OSGrid:
http://forums.osgrid.org/viewtopic.php?f=5&t=4335 [^]

And thought.... why not?

Could be handy for inworld health meters etc that are scripted.
All it is, is a slight adaption of osCreateDamage, without the "damage/teleport" part, returning the health float as an integer.

If you looking for something that alerts a script when an avatar has died, this is not it! Your going to have to check for that in other ways.

Usage:
float health = osGetHealth(avatarKey);
Steps To ReproduceN/A
Additional InformationExample usage:
    
    default
    {
        touch(integer t)
        {
            key agentID = llDetectedKey(0);
            osCauseDamage(agentID, 50);
            llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
        }
    }


Returns -1.000000 if the avatar is not found or Safe is switched off in the region.
TagsNo tags attached.
Git Revision or version number19417fca41e
Run Mode Grid (Multiple Regions per Sim)
Physics EngineODE
Environment.NET / Windows32
Mono VersionOther
ViewerPhoenix Viewer 1.6.1 (169
Attached Filespatch file icon 0001-Adds-osGetHealth.patch [^] (3,700 bytes) 2012-08-09 17:04 [Show Content]
patch file icon 0001-Removed-land-checking-as-suggested-by-SignpostMarv.patch [^] (1,839 bytes) 2012-08-10 00:31 [Show Content]

- Relationships

-  Notes
(0022008)
TBG Renfold (reporter)
2012-08-09 17:13
edited on: 2012-08-09 17:13

Made bit of a mess with the patch upload, hopefully all sorted now.

(0022009)
SignpostMarv (reporter)
2012-08-09 18:00

I would hazard a guess that it should return the health even if damage in enabled- avatar health is tied to the avatar, not per-parcel, so you could speed it up by bypassing the land data check.
(0022010)
TBG Renfold (reporter)
2012-08-09 20:05

Removed land checking as suggested by SignpostMarv.

Now whatever remaining health the avatar has is displayed (float).
This will be 100% (100.000000) if no damage has occurred (as what the viewer should really be seeing anyway).

Returns -1.000000 if the avatar is not found (as before).
(0022011)
SignpostMarv (reporter)
2012-08-10 08:42

I'm also curious as to the -1.0 for avatars not found; Could damage-causing functions & objects cause a discovered avatar to have a health less than zero ?
(0022012)
TBG Renfold (reporter)
2012-08-10 10:53

Well I have tried out dealing the avatar damage more than 100% (in small hits and one big hit over 1000%), I don't seem to be able to get the avatars health below 0.0, as soon as that is hit (or any value that would work out lower) the avatar is tp'd home and health reset to 100%.

On the flip side, I have noticed that an avatars health can be pushed further that 100%, not sure if that is by design though.

So in theory, -1.0 should be only returned when the avatars scene presence is not found.
(0022427)
justincc (administrator)
2012-08-23 23:15

Applied as git master 43fabae and a3cbda0, thanks TBG Renfold!
(0022428)
justincc (administrator)
2012-08-23 23:24

Could you add this to http://opensimulator.org/wiki/Category:OSSL_Functions [^] ? Thanks.
(0022429)
justincc (administrator)
2012-08-23 23:24

Will need to note that this is in master dev but will not be in 0.7.4

- Issue History
Date Modified Username Field Change
2012-08-09 16:26 TBG Renfold New Issue
2012-08-09 16:26 TBG Renfold File Added: 0001-Adds-osGetHealth.patch
2012-08-09 16:27 TBG Renfold File Added: 0001-Changes-osGetHealth-threat-level-from-Nuisance-to-No.patch
2012-08-09 16:38 TBG Renfold Additional Information Updated View Revisions
2012-08-09 16:39 TBG Renfold Additional Information Updated View Revisions
2012-08-09 16:43 TBG Renfold Status new => patch included
2012-08-09 17:03 TBG Renfold Description Updated View Revisions
2012-08-09 17:04 TBG Renfold File Deleted: 0001-Adds-osGetHealth.patch
2012-08-09 17:04 TBG Renfold File Deleted: 0001-Changes-osGetHealth-threat-level-from-Nuisance-to-No.patch
2012-08-09 17:04 TBG Renfold File Added: 0001-Adds-osGetHealth.patch
2012-08-09 17:13 TBG Renfold Note Added: 0022008
2012-08-09 17:13 TBG Renfold Note Edited: 0022008 View Revisions
2012-08-09 17:56 TBG Renfold Additional Information Updated View Revisions
2012-08-09 18:00 SignpostMarv Note Added: 0022009
2012-08-09 20:04 TBG Renfold File Added: 0001-Removed-land-checking-as-suggested-by-SignpostMarv.patch
2012-08-09 20:05 TBG Renfold Note Added: 0022010
2012-08-10 00:31 TBG Renfold File Deleted: 0001-Removed-land-checking-as-suggested-by-SignpostMarv.patch
2012-08-10 00:31 TBG Renfold File Added: 0001-Removed-land-checking-as-suggested-by-SignpostMarv.patch
2012-08-10 08:42 SignpostMarv Note Added: 0022011
2012-08-10 10:53 TBG Renfold Note Added: 0022012
2012-08-18 11:32 DMX04 Issue cloned: 0006222
2012-08-23 23:15 justincc Note Added: 0022427
2012-08-23 23:15 justincc Status patch included => resolved
2012-08-23 23:15 justincc Resolution open => fixed
2012-08-23 23:15 justincc Assigned To => justincc
2012-08-23 23:24 justincc Note Added: 0022428
2012-08-23 23:24 justincc Note Added: 0022429


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker