Difference between revisions of "Key2Number"

From Second Life Wiki
Jump to: navigation, search
m
m (fixed broken lsl formatting)
 
Line 1: Line 1:
 
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]].
 
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>
+
<source lang="lsl2">  
 
integer Key2Number(key objKey) {
 
integer Key2Number(key objKey) {
 
   return ((integer)("0x"+llGetSubString((string)objKey,-8,-1)) & 0x3FFFFFFF) ^ 0x3FFFFFFF;
 
   return ((integer)("0x"+llGetSubString((string)objKey,-8,-1)) & 0x3FFFFFFF) ^ 0x3FFFFFFF;
 
}
 
}
</lsl>
+
</source>
  
 
[[Category:Wizardry and Steamworks]]
 
[[Category:Wizardry and Steamworks]]

Latest revision as of 07:41, 19 March 2015

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.

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