Skip to content

Instantly share code, notes, and snippets.

@humbletim
Last active July 2, 2016 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save humbletim/2672449fd7efd120ec68a0d7ab91bf0a to your computer and use it in GitHub Desktop.
Save humbletim/2672449fd7efd120ec68a0d7ab91bf0a to your computer and use it in GitHub Desktop.
canRezTmp tests
print('hostname: ', location.hostname);
print('logged in: ', Account.isLoggedIn());
print('username: ', Account.getUsername());
print('canAdjustLocks: ', Entities.canAdjustLocks());
print('canRez: ', Entities.canRez());
print('canRezTmp: ', Entities.canRezTmp());
var lifetimes = [ undefined, -1, 0, 1, 3, 5, 3600, 3601 ];
function rez(lifetime) {
rez.offset = (rez.offset || 0) + 1;
return Entities.addEntity({
type: 'Sphere',
lifetime: lifetime,
name: 'ttl ' + lifetime,
position: Vec3.sum(MyAvatar.position, { x: rez.offset / 10, y: 0, z: 0 }),
velocity: Vec3.UP
});
}
var rezzed = lifetimes.map(rez);
Script.setTimeout(function() {
rezzed.forEach(function probe(id, i) {
var props = Entities.getEntityProperties(id);
var requested = 'requested: ' + lifetimes[i];
if (props.id) {
print(requested, ' / reported: ' + props.lifetime);
Entities.deleteEntity(props.id);
} else
print(requested, ' / (deleted)');
});
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment