Jump to content

AlduousMcBurlington

Resident
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

2 Neutral

About AlduousMcBurlington

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm surprised no one caught my error; apparently llGetGMTclock() does return a float but it's truncated to the nearest second, making this function unusable lol I'm working on a fix, and if anyone's interested I can reply the corrected function to this thread or make a new post when I'm done.
  2. Actually, since the avatar is physical, I would think that replacing llSLPPF with llMoveToTarget(pos, 0.09); should actually work. But this is, again, me talking out of my hat.
  3. If it's in a HUD, only the wearer can hear it. EDIT: Another hack / workaround would be to play the sound at a very low volume and position the sounding object as close to the agent's camera as possible, although that requires you know where their camera is, which you'll need permissions for.
  4. Yes; this was more for a simple way to save time while iterating loops than anything else. For example... default { state_entry() { integer SE_placeholder = 0; while(SE_placeholder < 100) { DoSomethingTimeSensitive(); llWait(0.001); SE_placeholder += 1; } } } ... especially since timers raise event queues, which can be hard on the sim (at very low values).
  5. I never said it was multi-threaded, nor was I under that impression. I simply said it was a good way to prevent event queues from being dropped in cases where you would have otherwise used llSleep(). To Innula: I'd tend to agree wholeheartedly, except in cases where you want to confine wait times to a single event or method without having to worry about saving the current data being used in a global variable (i.e. a loop). Also, timers can be hard on the simulator depending on the floated time, so this is a viable alternative for practical purposes.
  6. Maybe something like... float meters_per_second = 3.2; // change this to set max speed of avatar //-------------------------------------------------------------------------------- float step; vector pos; key attacher; default { state_entry() { step = meters_per_second * 0.1; } attach(key attach_id) { if(attach_id != NULL_KEY && llGetAttached() > 0) { pos = llGetPos(); attacher = attach_id; llSetTimerEvent(0.1); } } timer() { vector current_pos = llGetPos(); if( llVecDist(current_pos, pos) > step ) { integer agent_info = llGetAgentInfo(); if( (agent_info & AGENT_WALKING) || (agent_info & AGENT_ALWAYS_RUN) ) { vector direction = current_pos - pos; if(direction.x > step) direction.x = step; else if(direction.x < -step) direction.x = -step; if(direction.y > step) direction.y = step; else if(direction.y < -step) direction.y = -step; if(direction.z > step) direction.z = step; else if(direction.z < -step) direction.z = -step; pos += direction; llSetLinkPrimitiveParamsFast(0, [PRIM_POSITION, pos]); } else pos = llGetPos(); } else pos = llGetPos(); } } Keep in mind that this does not account for agents crossing sim/region boundaries, and may cause a jerking motion when they're corrected; it's a decent example albeit written from scratch, so I have no idea about how compile-able it is.
  7. If anyone's looking for a way to llSleep() their script, but don't want to prevent event queues from mounting up during this time-period, I made a function that you can just plop into your code and use in the same way as llSleep() and it'll get rid of the nastiest part of that function. It'll also work over midnight time crossings, so you can use it at any time, anywhere, and it'll function exactly as expected, to a very accurate measurement (less than 0.00000001 seconds inaccuracy). llWait(float wait_time) { float start_time = llGetGMTclock(); while(TRUE) { float current_time = llGetGMTclock(); if(current_time >= start_time) { if(current_time - start_time >= wait_time) return; } else { if( (86400.0 - start_time) + current_time >= wait_time ) return; } } }
  8. So a little while back, while the forums were offline for the new site update, I had a question I wanted answered: what loops are fastest in mono, and what stipulations should be taken into account when scripting them? As it turns out, this is quite an interesting topic that has a lot of commentators scratching their heads. Well, I'm not here to talk about efficiency, but I am here to definitively conclude which loops appear to be fastest (and when they usually are). Using a simple script that can be found below, I conducted some tests (in mono) to see what loops finish fastest with no arguments inside of them to test the true speed of the loop itself, from a practical approach without considering the theory behind it. My results could be considered a little odd, as the answer of 'fastest' actually appears to vary based on how many iterations you happen to be looping through. The results of my particular test are printed below, as concluded by the script found at the end of the page: 'for' loop time to 100: 0.000000 'for' loop time to 1,000: 0.024513 'for' loop time to 10,000: 0.044505 'for' loop time to 100,000: 0.596119 'for' loop time to 1,000,000: 6.318980 'do-while' loop time to 100: 0.000000 'do-while' loop time to 1,000: 0.030374 'do-while' loop time to 10,000: 0.114235 'do-while' loop time to 100,000: 1.198419 'do-while' loop time to 1,000,000: 12.739420 'while' loop time to 100: 0.000000 'while' loop time to 1,000: 0.014845 'while' loop time to 10,000: 0.116710 'while' loop time to 100,000: 1.200627 'while' loop time to 1,000,000: 12.317580 loop time to 100: All loops evenly matched for practical purposes. loop time to 1,000: 'while' loops beats all; 0.015529 seconds faster than 'do-while', and 0.009268 seconds faster than 'for'. loop time to 10,000: 'for' loop beats all; 0.06973 seconds faster than 'do-while', and 0.072205 seconds faster than 'while'. loop time to 100,000: for loop beats all; 0.6023 seconds faster than 'do-while', and 0.604508 seconds faster than 'while'. loop time to 1,000,000: for loop beats all; 6.42044 seconds faster than 'do-while', and 5.9986 seconds faster than 'while'. In simple conclusion, loops are a funny business and they can vary based on many probably factors. Please use the script to do the experiment yourself, as learning is always a personal endeavour! I hope this was helpful at least to someone, and that it might lead to better scripting habits in the future for all. Have a good one! default { touch_start(integer total_number) { if(llDetectedKey(0) == llGetOwner()) { llOwnerSay("Beginning loop test.\n "); integer i = 0; llResetTime(); for(i; i < 100; i += 1){} llOwnerSay("'for' loop time to 100: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 1000; i += 1){} llOwnerSay("'for' loop time to 1,000: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 10000; i += 1){} llOwnerSay("'for' loop time to 10,000: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 100000; i += 1){} llOwnerSay("'for' loop time to 100,000: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 1000000; i += 1){} llOwnerSay("'for' loop time to 1,000,000: "+(string)llGetTime()+"\n "); //----------- llSleep(2.0); //----------- i = 0; llResetTime(); do{i += 1;} while(i < 100); llOwnerSay("'do-while' loop time to 100: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 1000); llOwnerSay("'do-while' loop time to 1,000: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 10000); llOwnerSay("'do-while' loop time to 10,000: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 100000); llOwnerSay("'do-while' loop time to 100,000: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 1000000); llOwnerSay("'do-while' loop time to 1,000,000: "+(string)llGetTime() + "\n "); //----------- llSleep(2.0); //----------- i = 0; llResetTime(); while(i < 100){i += 1;} llOwnerSay("'while' loop time to 100: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 1000){i += 1;} llOwnerSay("'while' loop time to 1,000: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 10000){i += 1;} llOwnerSay("'while' loop time to 10,000: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 100000){i += 1;} llOwnerSay("'while' loop time to 100,000: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 1000000){i += 1;} llOwnerSay("'while' loop time to 1,000,000: "+(string)llGetTime()); } } }
  9. Try saving the responses to two seperate variables in the timer script and using their data to verify if the timer function should be called. integer seen_CommandOne = FALSE;integer seen_CommandTwo = FALSE;default{ state_entry() { llListen(1, "", "", ""); } listen( integer channel, string name, key id, string message ) { if(message == "command one") seen_CommandOne = TRUE; else if(message == "command two") seen)CommandTwo = TRUE; if(seen_CommandOne == TRUE && seen_CommandTwo == TRUE) { llSetTimerEvent(10); } } timer() { //start event }} You can always reset the "seen_*" variables to both FALSE again whenever you wish to open the script to be triggered again (possibly at the end of the timer event). Hope this helps.
  10. For over a year and a half, a team of highly selected programmers, graphic artists and marketers have come together to create a game unlike no other. A game that until now has remained largely hidden; one that hopes to change the way games are played in the virtual world. A game to learn, to play, to earn and get paid. A game that's finally ready to be revealed to the public. Febrary 23rd, 2016 http://maps.secondlife.com/secondlife/Cadillac%20Ranch%20TX/132/125/39 3PM - 8PM SLT Convention starts at 3, Q&A @ 6 and afterparty 8PM + For the very first time ever you'll get the most pay at the lowest cost. Earn more than you thought possible, and drive high volumes of player traffic. Use your BX-Z 42 interstellar class starship to harvest resources and sell them for guaranteed cash. Refine them to materials and make fuel for things like combat, cloaking, repairing and more. Place resource prims on your land and feel the power of community run through you. Join us for our convention center launch, followed by Q&A about the game, which precedes the launch of the official game to be announced moments before the official after party. We all hope to see you there. And always remember Initiates: Beware the umber; be one with the light.
  11. If you haven't found anyone feel free to shoot me a message in game.
  12. If you still haven't found anyone feel free to give me a shout in-game.
  13. If you haven't found anyone yet feel free to give me a shout in-game.
  14. If you're still having trouble you can message me in-game.
  15. Hey there, drop me a line at 'alduousmcburlington.resident' in NC and we'll work something out from there if you are still looking for a scripter. Have a good one, Alduous
×
×
  • Create New...