Last active
July 2, 2016 23:02
-
-
Save humbletim/2672449fd7efd120ec68a0d7ab91bf0a to your computer and use it in GitHub Desktop.
canRezTmp tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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