Jump to content

Titty Luv

Resident
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Titty Luv

  1. Hey Ruthven, Yes, this is more what I had in mind. Apologies for not making it as clear as I'd liked Rolig. (your solution works well, but it's not quite what I was going for. I have no doubt that I'll find a use for it in the future so thank you!) I understand that this solution is pretty complicated as it requires calculating the time to target and then altering the damping mid-movement. I don't expect anyone to go out of their way to write a solution, but any pointers would be fantastic.
  2. Hey guys! So this one's got me a little stumped, I don't know how to approach this to get the desired result. I'm making some "drones" that will wander, but also follow and move between a predefined set of positions within a sim. I've opted for llMoveToTarget for this, but face an inconsistency, if you will. I somehow need to calculate the damping value for llMoveToTarget based on the distance between vector points, so that the movement speed of the drone seems "realistic". By this I mean, for a short distance the drone should move slower between the points, but for a longer distance it should speed up to make the wait less, but without snapping to the target point. I've already toyed with the idea of using llVecDist for this, but don't quite get how I can use it for my issue. Any input would be fantastic!
  3. Yes everybody requires premium, or yes you can bypass having to be premium by using groups?
  4. Thanks, i'll take this into account. How much of a hastle would it be to alter this to do subtractions? I'm guessing that the same basic prinipal stays the same, but the carry is treated differently?
  5. This is exactly what I was aiming to achieve. Thank you very much for your input!
  6. Thanks for the reply Qie. The bignum implementation that you linked isn't really suitable for the numeric manipulation i'm working with. What it all boils down to really is just adding 2 numbers that exceed the integer size limit. From there everything else becomes easy. The current implimentation I have is very basic, and ALMOST works. And isnt too intensive as it stands. I'm guessing there is something wrong with my logic that causes the output to behave in such a strange manner. Your suggestion to use characters other than base ten is a good one, and could speed things up as numbers get larger and larger. I'll definately look into this after the logic has been fixed!
  7. So I'm working on a project in which I need to be able to store and work with numbers that exceed the integer size limit. To try and break-out of the integer limitations, I have written a script that adds two strings instead: string str1 = "123456789"; string str2 = "123456789123456"; string StringPad(string source, integer number) { string str = ""; integer x; for (x = 0; x < number; x++) { str += "0"; } return str + source; } string StringLeftTrim(string source) { integer x = 0; string str = llGetSubString(source, 0, 0); while (str == "0") { str = llGetSubString(source, x, x); ++x; } return llGetSubString(source, x - 1, -1); } string StringReverse(string source) { string str; integer x; integer len = llStringLength(source); for (x = 1; x <= len; x++) str += llGetSubString(source, len - x, len - x); return str; } string BigIntAdd(string st1, string st2) { integer carry = 0; integer length1 = llStringLength(st1); integer length2 = llStringLength(st2); string final = ""; integer dif; integer i; llSay(0,st1+"+"+st2); if(length1 < length2) { dif = length2-length1; st1 = StringPad(st1,dif); } else if(length1 > length2) { dif = length1-length2; st2 = StringPad(st2,dif); } else if(length1 == length2) { dif = length1; } length1 = llStringLength(st1); length2 = llStringLength(st2); do { integer i1 = (integer)llGetSubString(st1,length1,length1); integer i2 = (integer)llGetSubString(st2,length2,length2); integer i3 = i1 + i2 + carry; if(i3 > 9) { carry = 1; i3 = i3 - 10; } else { carry = 0; } final+=(string)i3; length1--; length2--; } while(length1 >= 0); //final+=(string)carry; final = StringLeftTrim(final); final = StringReverse(final); final+=(string)carry; //final return final; } default { state_entry() { llListen(123,"",llGetOwner(),""); } touch_start(integer total_number) { llSay(0, BigIntAdd(str1,str2)); } listen(integer ch, string n, key id, string msg) { list tmp = llParseString2List(msg,["+"],[]); llSay(0,BigIntAdd(llList2String(tmp,0),llList2String(tmp,1))); } } There are however, a few issues. The 'carry' integer adds an additional 0 onto the end of the final string when it is not needed, but not when the number actually does end on 0 (from what i've seen.)Adding two numbers that round up can cause interesting results. (5+5, 555+55555055, 999+999 etc)I'm sure this could be optimised further.If anyone could enlighten me as to why this is happening, or have suggestions for optimisation I'd greatly appreciate it!
  8. Ok, so I have been working on a "Skating AO" for myself and a few friends, and have ran into an issue with the whole scripting process. I have managed to create a script that will detect the rail based on the rail's name using an attachment with llCollisionFilter ??, and play an animation, sound, and apply force to the avatar when the rail is detected. The issue I am facing is keeping the avatar on the rail itself. I was wondering if there was a way to detect an object's centre position along the length of a prim, and centre the avatar there while force is being applied without having to sit on an object. A few friends have suggested raytrace/traceray, but to my knowledge it does not work with attachments. I have seen something similar to this being done before, and just wondered if anyone here could help shed some light on the situation. Thanks in advance to anyone who posts.
×
×
  • Create New...