Jump to content

Ruthven Ravenhurst

Resident
  • Posts

    491
  • Joined

  • Last visited

Everything posted by Ruthven Ravenhurst

  1. How are you delivering this hud? is it something you're planning on selling? if so, i can see someone buying from the vendor in person, and rather than the vendor giving the hud to the avatar, it rezzes it out, then tells it to request temp attach perms. otherwise, i think the only way to automate deletion from user inventory is maybe with RLV? ETA: just checked the list of commands for RLV and it looks like it's not possible to have it delete inventory
  2. You can also use llTakeControls, and when the avatar starts or stops moving by keyboard control, the control event is triggered. You would then check if agent is walking with the first snippet that rolig suggested. When that returns true, you want the ball to move. Then follow that test with an else test, which is will pass when the avatar is not walking, and that is where you want to make the ball stop moving ETA: also the advantage of the llTakeControls, is that it works in no-script areas
  3. For the emitter to not move with the avatar, it will have to not be attached. Depending on how long you want the particles to last, you might be able to begin the emission, with the max life of the particles, and then shut off the emitter when the avatar starts moving.
  4. You can use llSameGroup(avataruuid) to check to make sure they're in the correct group (assuming the object the script is in will be assigned to the same group) and then you would use llGetObjectDetails(avataruuid,[OBJECT_GROUP_TAG]) to get the text of the group tag
  5. I have no idea with this one. I don't know what that means: This problem was asked by Google. Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree. For example, given the following Node class class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right The following test should pass: node = Node('root', Node('left', Node('left.left')), Node('right')) assert deserialize(serialize(node)).left.left.val == 'left.left'
  6. I signed up for it too, here is the one I got today. This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? list test = [9,4,6,7,3,8]; integer k = 12; integer check() { integer i = 0; integer len = llGetListLength(test); for(i;i<len;i++) { integer Ti = 0; integer Addend1 = llList2Integer(test,i); for(Ti;Ti<len;Ti++) { if(Ti != i) { integer Addend2 = llList2Integer(test,Ti); integer sum = Addend1+Addend2; if(sum == k) { return TRUE; } } } } return FALSE; } default { state_entry() { llOwnerSay(llList2String(["False","True"],check())); } touch_start(integer total_number) { llResetScript(); } } [11:51] True
  7. list test = [1,2,3,4,5]; default { state_entry() { list output = []; integer i = 0; integer len = llGetListLength(test); for(i;i<len;i++) { list calc = llDeleteSubList(test,i,i); integer Tlen = llGetListLength(calc); integer Ti = 1; integer product = llList2Integer(calc,0); for(Ti;Ti<Tlen;Ti++) { product = product*llList2Integer(calc,Ti); } output += [product]; } llSay(0,llList2CSV(output)); } touch_start(integer total_number) { llResetScript(); } } Object: 120, 60, 40, 30, 24
  8. i typically try not to just give a complete script in the forums unless it's a modification of the OP script, but this seemed like a simple enough one. Just drop this into an object you wear that you want others to click. Drop in the animation you want to use, and type in the name at the top of the script. Pick it up and attach it. integer toggle; string animation = "";//add animation name default { attach(key id) { if(id) { llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION); } else { if(llGetPermissionsKey()) { toggle = 0; llStopAnimation(animation);//stops the animation if you detach the object } } } run_time_permissions(integer perms) { if(perms & PERMISSION_TRIGGER_ANIMATION) { llSetText("Touch me to make me animate",<0.0,0.0,1.0>,1.0); } } touch_start(integer total_number) { toggle = !toggle; if(toggle) { llStartAnimation(animation); llSetText("Touch me to stop animation",<0.0,0.0,1.0>,1.0); } else { llStopAnimation(animation); llSetText("Touch me to make me animate",<0.0,0.0,1.0>,1.0); } } }
  9. good, you have the half texture already. There's a little math involved. If the split in the texture is vertical, you'll want to scale and offset the texture horizontally, and if the split is horizontal..... so the scale would just be half the offset would be the percentage as a decimal, divided in half, then subtract 0.25. here's an example script using a black/white texture with the split being vertical. You could use the same texture on either side and change the color accordingly as well as flip the texture by giving it a negative scale integer health = 100; default { touch(integer total_number) { if(health > 0) health--; float healthperc = (float)health/100.0; float offset = (healthperc*.5)-0.25; llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE,0,"blackwhitehalf",<-0.5,1.0,0.0>,<offset,0.0,0.0>,0.0, PRIM_TEXT,(string)((integer)(healthperc*100))+"%",<0.0,1.0,0.0>,1.0]); } }
  10. This is because you're requesting permission to animate in the same function as the ball moving. The animation doesn't get triggered until the permissions event is triggered, but it can't do that until your function is finished.... You only need to request permissions once, then in your function, you can start the animation before moving the ball. Try this, i cleaned up your script a bit. If you still need a little more time before the ball moves after starting the animation, you'll need to put a sleep after triggering the animation myFunction() { llStartAnimation("backflip");//start the animation before starting the ball moving integer x = 0; for (x = 0; x <= 10; x++) //this loop moves the ball up { llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_POS_LOCAL, llGetLocalPos() + < 0, 0.0, 0.05 > ]); //put command to increment prim's local position here llSleep(0.1); //put command for 0.1 sleep here } for (x = 0; x <= 10; x++) //this loop moves the ball down { llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_POS_LOCAL, llGetLocalPos() + < 0, 0.0, -0.05 > ]); //put command to decrement prim's local position here llSleep(0.1); //put command for 0.1 sleep here } } default { on_rez(integer rez_param) { if(llGetAttached())//checks to see if it's attached instead of being rezzed onto ground { llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); } else//if not attached, timer is turned off so the ball doesn't move { llSetTimerEvent(0); } } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llSetTimerEvent(3);//after we've got permission to play the animation, let's start the timer so the ball can bounce } } timer() { myFunction(); } }
  11. basically the same thing as above, but done with 1 loop vector start; bounceball() { integer x; for(x = -10; x < 10; x++) { vector pos = start + <0,0,0.05*(llFabs(x)-10)>; llSay(0,(string)pos); llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_POS_LOCAL,pos]); llSleep(0.1); } llSetPos(start); } integer onoff; default { state_entry() { start = llGetLocalPos(); } timer() { bounceball(); } touch_start(integer total_number) { llSay(0,"boing"); llSetTimerEvent(10*(onoff = !onoff)); if(onoff)bounceball(); } }
  12. You may try making some other change to the prim, even one that wouldn't really be visible, such as adding and removing hover text in the same sequence in when it should move. That usually forces the viewer to redraw the prim and in which case it will move on the screen as desired
  13. it will unsit them, and typically the furniture won't respond to them when they're no longer sitting on it
  14. Certainly, that would be an easy enough script, here's a starting point (not tested) list whitelist = ["name 1"];//add the names of the people you want to allow, case sensitive default { changed(integer change) { if(change & CHANGED_LINK) { key id = llAvatarOnSitTarget(); if(id) { name = llKey2Name(id); integer index = llListFindList(whitelist,[name]); if(index == -1 && id != llGetOwner()) { llUnSit(id); } } } } }
  15. I would start with the formatting of the card, for example: would become This way the question and answer key is always an even number line, separated by the pipe character, and the answers are always on an odd numbered line, separated by the pipe character then for the list of line numbers, first check the number of lines in the card, then build a list of line numbers, then randomize it: (typed up in the forum text box, not tested) integer numlines;//using llGetNumberOfNotecardLines //then build the list list linenumbers = []; buildlist() { integer i; for( i = 0; i < numlines; i+=2) { linenumbers += [i]; } linenumbers = llListRandomize(linenumbers,1); }
  16. And I suppose you could also add the creator's key to the code, because even if you were to manage to find an object with the exact same creation time, it would be impossible to have the same creator
  17. Here's a method using the creation time of the object. The key can't be cheated, and the worn object won't need to have a script in it for the door to check it. This snippet can be used in any script that will detect an avatar (touch, collision, sensor) in order to check they are wearing the key rez/create the key object you want to use, and paste this script into it. default { state_entry() { list details = llGetObjectDetails(llGetKey(),[OBJECT_CREATION_TIME]); llOwnerSay(llList2CSV(details)); llOwnerSay("Paste the above string into the door script where appropriate"); llRemoveInventory(llGetScriptName()); } } the "key" object will spit out a creation time string. then in the door script, to authenticate paste the above string where it says keycode string keycode = "PASTE KEY CREATION TIME HERE"; integer checkforkey(key id) { list attachments = llGetAttachedList(id);//gets the list of attachments the avatar is holding integer len = llGetListLength(attachments); integer i; for(i = 0; i < len; i++)//checks each attachment one by one and compares their creation time to the one pasted above { key attachment = llList2String(attachments,i); list details = llGetObjectDetails(attachment,[OBJECT_CREATION_TIME]); string time = llList2String(details,0); if(time == keycode)return TRUE; } return FALSE; } default { touch_start(integer total_number) { key id = llDetectedKey(0); string name = llGetDisplayName(id); integer haskey = checkforkey(id); if(haskey) { llSay(0,"Welcome " + name + "!"); //do door opening stuff } else { llSay(0, "Sorry " + name + ", but you need to holding (wearing) the key to open this door"); } } }
  18. Solution 1: use a non-zero integer in the last param of the rez command. The reason is, when an avatar rezzes an object, the on_rez event only receives a zero as the rezparam In rezzer script: llRezObject("object name",pos,velocity,rotation,a non zero integer); in the object being rezzed: on_rez(integer rezparam) { if(rezparam)//will test true if it's non-zero { //give contents or whatever } else//was rezzed by avatar { llDie(); } } solution 2: use this for the on_rez event in the object being rezzed on_rez(integer rezparam) { list details = llGetObjectDetails(llGetKey(),[OBJECT_REZZER_KEY]); key rezzer = llList2Key(details,0); if(rezzer != llGetOwner())//if rezzer doesn't equal the owner key, then it was rezzed by an object { //give contents or whatever } else { llDie(); } }
  19. The easiest solution, that requires planning in the rezzer script, is to use the final parameter in the llRezObject command. Use an integer other than 0. In the object being rezzed, in the on_rez(integer rezparam) event, check that rezparam is not 0 The other solution, if for some reason you can't access the script with the rez command, is in the on_rez event, use llGetObjectDetails(llGetKey(), [OBJECT_REZZER_KEY]); Then extract that key from the list, and compare it to the owner key, if they aren't a match, it was rezzed by an object
  20. i looked at the revision history of that page. it looks like Lowell Fitzgerald contributed that example. If you're serious about figuring out what OLF means, maybe see if they're still around to ask? I know sometimes I'll get something in my head that seems insignificant to others, it'll still bother me until i figure it out lol. Like if you see a familiar face and can't figure out where you know them from.
  21. one possible one that i found while searching google is "Overload Factor", but in this context maybe it's Open Loop Factor? I also saw one that said Open Loop Feedback, but not sure what the feedback in this context would be
  22. You could parcel off a small section for the public, and set the landing point at the height you want Heaven to be. Then set the remaining land to group only access. The ban lines will only work up to a certain height, (100m?) So that would be enough to make the ground group only, and the sky public
  23. An old work around would be to give the players a teleport hud/attachment. The attachment will take teleport permissions of the wearer, being the owner. When they walk through a door (using llVolumeDetect) the door could communicate on a hidden channel to the attachment who walked through, and where to teleport them to. Then the attachment would teleport them to the desired location using the functions mentioned above. No Experience needed for that. The downside is, if the parcel has teleport routing to a specific spot, the method I describe won't work. But if using an experience for it, it overrides the teleport routing
  24. One thing you could do, is set the prim physics for the door to none while it is open, assuming it is a child prim, and then switch it back to prim or convex when closed
×
×
  • Create New...