Difference between revisions of "Key2Number"

From Second Life Wiki
Jump to: navigation, search
m (if you don't want it negative, never turn the bit on. Now you risk the chance that the number will be zero.)
m
Line 6: Line 6:
 
}
 
}
 
</lsl>
 
</lsl>
 +
 +
[[Category:Wizardry and Steamworks]]

Revision as of 11:42, 3 June 2012

A function that, when passed a key will return an unique hash in the form of an integer based on the the llDialog article on the Second Life wiki. This can be used, for example, to pass an avatar name to a rezzed primitive using llRezObject.

<lsl> integer Key2Number(key objKey) {

 return ((integer)("0x"+llGetSubString((string)objKey,-8,-1)) & 0x3FFFFFFF) ^ 0x3FFFFFFF;

} </lsl>