While copying the code for LBA Slim as a base for a new LBA tester I'm working on, I noticed some inefficiencies in the code that defeat the purpose of Slim.
|
integer cap = 0; |
|
integer link = 0; |
|
integer hex; |
|
key me; |
|
float rev=2.3;//Current revision number, for just making sure people know you're on version X Y Z. |
|
handlehp()//Updates your HP text. The only thing you should really dick with is the text display. |
|
{ |
|
if(hp<0)hp=0; |
|
string info="LBA.v.L."+llGetSubString((string)rev,0,3)+","+(string)hp+","+(string)maxhp; |
On line 3,
cap is a variable that is set in two places (the other being line 19) but never used, as line 56 is commented out.
On line 5,
hex, which is the channel to listen for damage messages, does not need to be stored. More on this further down.
On line 7, the version number is stored as a float. I suggest changing it to a string, because on line 11,
2.3 as a float is changed to
2.30 as a string. This issue is also present in other editions of LBA 2.3, making it effectively "LBA.v.2.30" to scripts.
Because line 22 can be run more than once by repeatedly picking up and re-rezzing an object containing this script, it's important to remove the previous listen handle ID and store the new one. This is similar to the issue I pointed out in the main LBA script where a vehicle could repeatedly cross regions to render itself immune to damage. The same can happen with this script, even if it doesn't move itself. Resetting on rez is an alternative, but this removes the ability to set a specific starting HP through the rez param.
Line 48 is redundant because if we have only one listen active, it already filters for the correct channel.
|
if(dmg<-15)dmg=-15;//Cap to -15, stops overflow attempts. |
Line 54 hard caps the maximum repair rate, which goes against the philosophy of using LBA Slim to minimize both performance impact and auto-moderation. I suggest changing
-15 to
-maxhp or removing this line entirely.
While copying the code for LBA Slim as a base for a new LBA tester I'm working on, I noticed some inefficiencies in the code that defeat the purpose of Slim.
SLMCLBA/LBA-Slim-v.2.3.lsl
Lines 3 to 11 in c92c231
capis a variable that is set in two places (the other being line 19) but never used, as line 56 is commented out.On line 5,
hex, which is the channel to listen for damage messages, does not need to be stored. More on this further down.On line 7, the version number is stored as a float. I suggest changing it to a string, because on line 11,
2.3as a float is changed to2.30as a string. This issue is also present in other editions of LBA 2.3, making it effectively "LBA.v.2.30" to scripts.SLMCLBA/LBA-Slim-v.2.3.lsl
Line 22 in c92c231
SLMCLBA/LBA-Slim-v.2.3.lsl
Line 48 in c92c231
SLMCLBA/LBA-Slim-v.2.3.lsl
Line 54 in c92c231
-15to-maxhpor removing this line entirely.