# Innula Zenovka

10,096

2. ## How do I detect if a sensor placed at vPos would see someone standing at vTargetPos?

Thank you! I've not really appreciated the distinction between the two different types of vector before, and how they can represent both position and direction (I mean, I knew they could, but hadn't really thought about what that actually means in practice). So when I calculate a dot product, would I be correct in understanding that it's an expression of the relationship between two directional vectors (the cosine of the angle between them) anywhere they happen to intersect?
3. ## How do I detect if a sensor placed at vPos would see someone standing at vTargetPos?

As an alternative to using the centre of the cone for vX, you mean, rather than as an equivalent to?
4. ## How do I detect if a sensor placed at vPos would see someone standing at vTargetPos?

No, I meant I think I can calculate X on the fly, can't I?: vector vTargetPos; vector vSensorPos; rotation rSensorRot; float fRange = 20.0; float fAngle = 0.5* PI_BY_TWO;//45 degree cone vector vX = vSensorPos+<(fRange * 0.75),0.0,0.0> * rSensorRot; vector vDiff = vTargetPos - vSensorPos; if((vDiff*vDiff)>(fRange*fRange)){ //out of range } if(llRot2Angle(llRotBetween(vDiff,vX))> fAngle){ // the angle between target and the local x vector of the sensor is too big } else{//the opposite of the previous two tests, and the calculation I think I need if( ((vDiff*vDiff)<(fRange*fRange)) && (llRot2Angle(llRotBetween(vDiff,vX))< fAngle)){ llOwnerSay("the sensor can see the target"); } }
5. ## How do I detect if a sensor placed at vPos would see someone standing at vTargetPos?

Is that the cone's centre of mass (25% of the distance from the base -- the flat bit at the big end) and the vertex (the sensor)? I know the sensor's position would be, if I were using a sensor, and I know what its rotation would have been, and I know the range, so I can calculate X from that, I think, can't I?
6. ## How do I detect if a sensor placed at vPos would see someone standing at vTargetPos?

How, then, do I calculate whether the target's z value, minus that of the test point, is in range? I can see it's a similar calculation, but I'm not sure how to perform it. Or is there an easier way to do it?
7. ## How do I detect if a sensor placed at vPos would see someone standing at vTargetPos?

Am I right in thinking that I subtract vPos from vTargetPos and then examine llAxisAngle2Rot(<0.0, 0.0, 1.0>, llAtan2(vResult.y, vResult.x)) to see if the result is within a certain range? Or does that just tell me if it's within my field of vision in the x,y plane but not the cone that llSensor draws? Or, if I'm completely wrong, which is generally the case when I'm unsure about matters geometrical, how do I do it, please?
8. ## Understanding Ban-lines

Yes, but that's a very specific use case, I think. Not many people run animatronic knocking shops or whatever on their land, after all, and if they do, I'd have thought the rezzers could solve the problem, should it arise, by checking who on the parcel owns what before they try to rez a playmate, and if someone's seated on something that doesn't belong to the landowner that's too high an LI to allow this, simply have the script unsit and send them home, which should also trigger object return shortly afterwards. Would something like that not work?
9. ## Understanding Ban-lines

Yes, but if they're not using it for the 10 seconds or however long it takes me to drive across their parcel, what's the harm? If there's a problem, surely it results in my vehicle not being able to enter their parcel rather than in their objects being returned from the parcel?
10. ## Understanding Ban-lines

Even if you don't have rez rights on my parcel?
11. ## Understanding Ban-lines

Are you sure about this? One of my alts has just rezzed a car on their plot on Bellisseria: This is the resulting LI When my alt gets in the vehicle, drives it off the parcel and onto the road, and then checks the parcel LI, this is the result So initially the LI comes out of what's available on my land, but then it comes out of the region LI when I drive off.
12. ## Understanding Ban-lines

I may be mistaken, but doesn't the vehicle's LI (and that of any of its passengers, come to that) come out of the region's "spare" LI that's allocated to, but not currently in use by, individual parcels? That is, the same pool of spare LI than temp-on-rez objects use? If the region is literally full, vehicles can't enter it, of course, but otherwise I don't see how LI matters. I might not want vehicles crossing my land, or even one of their wheels temporarily impinging on it, for all sorts of reasons, but I don't think LI needs to be one of them.
13. ## sit target height adj

The other option, I guess, would be a ray cast to see what's directly underneath the avatar. Hard to go wrong with that, I'd have thought.
14. ## sit target height adj

Depends what you're trying to calculate, of course, but if you want the position of the avatar's feet, I think the calculation is vector vAvSize = llGetAgentSize(kAv); float f = -1*((vAvSize.z*1.1)/2); (and then add f to the avatar's z coordinate, of course). That's what I use for traps and things, anyway.
15. ## LSL functions and probabilities

I'm so glad I asked this question. I'm learning so much that I can apply not only to my animesh critters but more generally to all sorts of "random" events where a simple llFrand(n) isn't the right solution. Thank so much all!
16. ## LSL functions and probabilities

I'm trying to design something that will handle generic behaviour for my pathfinding critters when nothing happens to disturb them -- they simply play a few animations for a few minutes and then they go off and do something somewhere else. So far I've got this (but I haven't really had a chance to look at Tessa's latest post. float fTotalRestTime = 290.0;//so max 5 minutes float fMinRestTime = 10.0; float fTotalAnimationTime = 20.0;//so max 30 seconds animation integer iIndex; //integer iMax; list lTimes; list lAnimationsToPlayWhileStopped; string strCurrentAnim; string strPreviousAnim; default { state_entry(){ lAnimationsToPlayWhileStopped = llListRandomize(lAnimationsToPlayWhileStopped,0); //iMax = -llGetListLength(lAnimationsToPlayWhileStopped); float fRand = llFrand(1.0); float f = (fRand*fRand); float fPeriod= fMinRestTime+(1-f)*(fMinRestTime+fTotalRestTime);//up to five minutes in all llOwnerSay("fPeriod is "+(string)fPeriod); //now build a list of how often to change anims do{ fRand = llFrand(1.0); f = (fRand*fRand); lTimes +=[fMinRestTime+ (1-f)*fTotalAnimationTime ];//animations play for between 10 and 20 seconds } while(llListStatistics(LIST_STAT_SUM, lTimes)<fPeriod); llOwnerSay(llList2CSV(lTimes)); llOwnerSay("total of lTimes is "+(string)llListStatistics(LIST_STAT_SUM,lTimes)); //this is always going to be slightly more than fPeriod, but close enough for what I need iIndex = -llGetListLength(lTimes); //start first animation strCurrentAnim = llList2String(llListRandomize(lAnimationsToPlayWhileStopped,1),0); llStartObjectAnimation(strPreviousAnim = strCurrentAnim); llSetTimerEvent(llList2Float(lTimes,iIndex)); } timer(){ if(++iIndex){ do{ //choose a new anim strCurrentAnim = llList2String(lAnimationsToPlayWhileStopped,0); if(strCurrentAnim == strPreviousAnim){ strCurrentAnim = llList2String(lAnimationsToPlayWhileStopped,1); } } while(strCurrentAnim == strPreviousAnim); lAnimationsToPlayWhileStopped = llListRandomize(lAnimationsToPlayWhileStopped,1); llStartObjectAnimation(strCurrentAnim); llStopObjectAnimation(strPreviousAnim = strCurrentAnim); llSetTimerEvent(llList2Float(lTimes,iIndex)); } else{ llSetTimerEvent(0.0); //do some pathfinding stuff } } }
17. ## LSL functions and probabilities

I know it's not what I described, exactly, but I suspect I may have some sort of sine wave in mind, if only I knew how to express it.
18. ## LSL functions and probabilities

In my example, I'm saying that, after 10 seconds, the probability of something happening (critter moving to a new location/choosing a new animation/whatever) starts at 10% and then increases by 1% for each second that elapses. So for the first fifty seconds, it's more likely than not the critter will carry on doing whatever it is, though the likelihood it will decide on a new activity is slowly increasing over time and after fifty seconds it becomes increasingly likely it'll go off and do something else until, after 100 seconds have elapsed, it's certain to change.
19. ## LSL functions and probabilities

This is where I reveal, yet again, my compete ignorance of mathematics. I dimly remember things from high school but when I come to apply them, it's no more than half-remembered fragments of a foreign language. Anyway, I was recently trying to think how to script it to ensure that something would happen within n seconds, but randomly within that, while trying to ensure that, as time passed, the likelihood that whatever it was would happen increased. That is, in this particular case, I wanted my pathfinding critter to behave more or less realistically -- after wandering for a bit, it stops for at least 10 seconds, and then thinks about about what to do. Probably once it's arrived somewhere it'll at least want to stay there a bit, foraging or resting or whatever, but the more time passes, the more likely it is to want to move on. Sometimes it'll want to move on right away, and sometimes it'll want to stay there up to a minute or so, and most of the time somewhere between that. I came up with this, which does what I need integer iNeedToBeat; integer iRandom; default { state_entry() path_update(integer Type, list Reserved) { if(PU_GOAL_REACHED == Type){ iNeedToBeat = 100; llSetTimerEvent(1.0); } } timer() { if((integer)llFrand(100.0)>(--iNeedToBeat)){ if(iNeedToBeat < 90){ //then do whatever it is, so long as at least 10 seconds have passed } } } } That is, the pathfinding creature will always wait at least 10 seconds before deciding if it wants to do something new, and then, as time progresses, it becomes increasingly likely to move on to whatever this "something new" is, until it actually does so. That's the basic idea, anyway, though in practice it's going to be somewhat more complex than that. I have two questions, I think. First, I'm sure that what I've done there can be done more elegantly with some mathematical formula, if only I knew how to express it in LSL. Can anyone help me? Second, more generally, how else can we readily use LSL to calculate probabilities, and for what kinds of purposes might be do it? There must be dozens of other interesting things we can do with chance, odds and probability other than skill gaming and gachas. There's breedables, of course. What else?
20. ## Object loses its "touch" attribute

First, read this Knowledge Base article and then take a look at the Experience Tools page in the Scripting Wiki. Also search this forum. Though I would strongly advise posting data to Google Sheets or some other external source rather than using experience keys to store this kind of data. I've done a lot of work with both Experience Tools' KVP functions and with Google Sheets, and they're two completely different tools, suitable for very different purposes. Experience Tools and KVP are great for data you want to store and update persistently, and share grid-wide in (almost) real time, but they aren't good for storing lots of historical data you want to access at all readily.
21. ## The new VP of engineering at Linden Lab

Didn't the late Ebbe Linden used to work for Microsoft? I thought he was the best CEO LL's had for a long time.
22. ## logical variable

And I learned it (along with just about everything I know about rotations*, and a lot more besides) from @Void Singer, who is sadly missed. *not forgetting @Grandma Batesand @Chalice Yao. But Void patiently laid the foundations.
23. ## Object loses its "touch" attribute

If the script is adding data to a list every ten seconds, I wonder if that might not cause a stack heap collision after a few hours if the script isn't properly monitoring script memory and pruning old list items when necessary. That's the first thing I'd look at, anyway, based on the bare fact that something that collects and stores data seems to become unresponsive every few hours.
24. ## What Do You Like To Do In Belli?

Where does the pale green come into it? I'd always thought it's simply "pale" ("deathly pale" in the Jerusalem Bible, apparently).
25. ## Photos and Videos of the Fantasy Regions, post here!!!

×
×
• Create New...