Jump to content

Wandering Soulstar

Resident
  • Content Count

    421
  • Joined

  • Last visited

Everything posted by Wandering Soulstar

  1. On further investigation, it is optimizing, but does not do replacements for strings, only integers. So the following: string cons = "HHH";string b;integer y = 3;default { state_entry() { llOwnerSay(cons); llOwnerSay((string)y); }} is optimized to : // LSL script generated: opt.lslp Fri Jul 3 12:42:54 GMT Daylight Time 2015string cons = "HHH";default { state_entry() { llOwnerSay(cons); llOwnerSay("3"); }} Quite the pity as I was really hoping to have it do the replacements for strings as I like to write my code with psuedo-constants to make it more readable and manageable, but from a run memory perspective would like to have those psuedo-constants replaced.
  2. Nova, Yep, have Enable Optimization set. Brackets are not that big of a deal, but anoying and cannot find where to change. Found the 'problem' on the highlightiung, though if someone could explain why its a problem: Had the following code (comments) //--notecard values--//**end notecard values** as soon as I put a line between the two of them highlighting worked across the module.
  3. Hi All, After years and years of using LSL Editor I decided to take a look at what other more advanced IDEs there were out there. I have installed LSL Forge/Eclipse and on first run through it looks like it might be what I am looking for though there are a few things holding me back and hopefully someone out there can help me find the answers: * It automatically sets things to the K&R (Java) style brackets and I am used to the Allman (c) style. Is there anyway to have it use the Allman style? * It adds in parentheses everywhere in the generated lsl file. So a line of code that read: variable = "a"; is turned into (variable = "a"); * It removes all whitespace in the generated lsl file * I pasted in a ~1500 line script that I have and after about line 150 or so, in the lslp file it stops doing the colour-code highlighting * The last one is the real key for me. In the documentation it says 'The optimizer will figure out if a global variable is a constant (and can thus potentially be replaced with its value anywhere it is used). ' Yet it is not doing this in the generated lsl file. If it really does this then that would be the tipping point. Thanks! Wanda (Wandering) Soulstar
  4. Akira, The short answer is yes you can. You would need a likely need a couple of scripts, one each in the pet and accessory. The pet script would need to tell the accessory script where it needed to position itself, and the accessory then would need to move itself to said position and then link itself using llCreateLink (http://wiki.secondlife.com/wiki/LlCreateLink ). I imagine you'd want to make it a bit more complete, allowing for the removal of an existing linked accessory, etc.. The fact that it is mesh is irrelevant, in the end they are 'prims' from the point of view of LSL. Wanda
  5. Ok .. so I now see the block memory in action, though it does seem to be a bit selective when it does this. Sometimes it just adds the amount of memory as stated in the Wiki (as a noted above) and then at other points it makes the jump. I tried adding the if block, but with literals as opposed to psuedo-constants, to the base with these defined and the result was the same large jump that I saw before (4876) string B_USERS = "Users";string B_ABSENCE_OFF = "Absence Off";string B_ABSENCE_SET = "Set Absence";string B_DAY_NIGHT_OFF = "DayNight Off";string B_DAY_SET = "Set Day";string B_NIGHT_SET = "Set Night";list CONFIG_BUTTONS = [b_ABSENCE_OFF, B_DAY_NIGHT_OFF, B_ABSENCE_SET, B_DAY_SET, B_NIGHT_SET, B_USERS];default{ touch_end(integer total_number) { string s = "a"; if (s == "Absence Off") { //Do something } else if (s == "DayNight Off") { } else if (s == "Set Absence") { } else if (s == "Set Day") { } else if (s == "Set Night") { } else if (s == "Users") { } llSay(0, "cb: " + (string)llGetUsedMemory()); }} So definitely down to block grabbing, and not the definition of psuedo-constants. As far as I can see the use of these is really going to be down to the number of times they are used in the code vs the size of the literal.
  6. Nova .. actually not sure where you are gettng the 'memory is allocated in blocks', as far as I have read and noramlly seen that is not the case. If I take the first of the examples and simply add a global string declaration, the memory used goes up the number of bytes as indicated on the wiki for a string that size ...
  7. Nova, Yes I fully realize that LSL does not allow you to truly define constants, I've edited my post to hopefully make sure that comes across. I also fully understand the basics of how memory is supposed to be allocated in LSL, just that I have not looked in depth at it since MONO was released as I had not written anything that was bumping up against the memory limits until now. The 'double' storage in this example is something I am fully aware of and in the first pair of examples, the 218 difference is to be expected, and a hit I am happy to take for readability and maintainability. What it does not explain, and what I do not see explained in the Wiki is the second pair: Why in the first instance, having added code and literals does the memory not change Why in the second having done the same, but simply referencing the globals does the memory usage go up 522
  8. Good afternoon all, Have been coding away for a couple of weeks, and when finally bringing it inworld I realized that even in Mono I need to remember about memory usage when it comes to coding. Now apart from pulling my hair out trying to figure where I could fix things the most with the least amount of effort, I was looking at one general coding quirk of mine to see what overhead that might be causing. The quirk is that I like to code with Psuedo-Constants (knowing that LSL does not allow the definition of real constants), i.e rather than using literals like "button name" in my code I'll have a global called BUTTON_NAME. Now in a real coding language that, from what I remember, is good practice, and I remember back in the days of LSO coding there were situations (if memory serves me right) where it would end up saving memory. Now as I was looking at these things (and the ever helpful page on memory http://wiki.secondlife.com/wiki/LSL_Script_Memory ) I came across something that does not seem to make sense to me. The following code comes back with 4146 used: list CONFIG_BUTTONS = ["Absence Off", "DayNight Off", "Set Absence", "Set Day", "Set Night", "Users"]; default { touch_end(integer total_number) { string s = "a"; llSay(0, "sb: " + (string)llGetUsedMemory()); } }And then if I look at it with Psuedo-Constants it comes back with 4364, a change inline with what the wiki would suggest: string B_USERS = "Users"; string B_ABSENCE_OFF = "Absence Off"; string B_ABSENCE_SET = "Set Absence"; string B_DAY_NIGHT_OFF = "DayNight Off"; string B_DAY_SET = "Set Day"; string B_NIGHT_SET = "Set Night"; list CONFIG_BUTTONS = [B_ABSENCE_OFF, B_DAY_NIGHT_OFF, B_ABSENCE_SET, B_DAY_SET, B_NIGHT_SET, B_USERS]; default { touch_end(integer total_number) { string s = "a"; llSay(0, "cb: " + (string)llGetUsedMemory()); } }Now though I add more code to the script with no constants, and the used memory remains 4146, very strange as the use of more literals should increase the memory as far as I remember (at least it did in the LSO days): list CONFIG_BUTTONS = ["Absence Off", "DayNight Off", "Set Absence", "Set Day", "Set Night", "Users"]; default { touch_end(integer total_number) { string s = "a"; if (s == "Absence Off") { //Do something } else if (s == "DayNight Off") { } else if (s == "Set Absence") { } else if (s == "Set Day") { } else if (s == "Set Night") { } else if (s == "Users") { } llSay(0, "ss: " + (string)llGetUsedMemory()); } }Puzzling away I then add similar code to the Psuedo-Constants version, and not only does it not stay the same, it rockets up to 4876, a 522 increase that I have no idea where it comes from: string B_USERS = "Users"; string B_ABSENCE_OFF = "Absence Off"; string B_ABSENCE_SET = "Set Absence"; string B_DAY_NIGHT_OFF = "DayNight Off"; string B_DAY_SET = "Set Day"; string B_NIGHT_SET = "Set Night"; list CONFIG_BUTTONS = [B_ABSENCE_OFF, B_DAY_NIGHT_OFF, B_ABSENCE_SET, B_DAY_SET, B_NIGHT_SET, B_USERS]; default { touch_end(integer total_number) { string s = "a"; if (s == B_ABSENCE_OFF) { //Do something } else if (s == B_DAY_NIGHT_OFF) { } else if (s == B_ABSENCE_SET) { } else if (s == B_DAY_SET) { } else if (s == B_NIGHT_SET) { } else if (s == B_USERS) { } llSay(0, "start: " + (string)llGetUsedMemory()); } }So .... Any suggestions? Anyone able to explain to me what is going on? From this small example it would appear that my use of psuedo-constants could be one of the core areas for improvement in memory, though I do not understand why. Thanks in advanced from a puzzled and frustrated Wanda.
  9. Thaks all! And special thanks to Miranda for the example!
  10. Draggon, Not sure what your comment has to do with the OP. But to try and help you in any case, when you say 'purchased' a homestead, am I correct in assuming you' bought' it from another resident to whom you will be paying tier monthly? I have to assume this as you say that neither you nor your friend have Estate Manager rights, understandable if you have 'purchased' from another resident. BUT, that resident that you bought from DOES have Estate Manager rights and could very well have ordered the rollback.
  11. Hi all, Am unable to get in world atm to check this, and so thought I'd pop the question out. Looking to undertand which of the following is better (or if there is no difference) from a script memory usage perspective: for (x = 0; x < num; x++) { integer recordIdx = llList2Integer(fRecords, x); //Do some stuff }or declaring recordIdx outside the loop: integer recordIdx; for (x = 0; x < num; x++) { recordIdx = llList2Integer(fRecords, x); //Do some stuff }Thanks in advance!!! Wanda
  12. Hi Larrona, Apart from all of the above suggestions, I have used a Prim Alignment tool in SL for years now that simplified how I build amazingly when I first discovered it, and now could not imagine building without it. I cannot remember the name atm and am at work so cannot get inworld to check. Drop me an IM inworld to remind me and I'll send you the LM to the shop. Wanda (Wandering) Soulstar
  13. So with Nova clearing up the differences for me, I was able to quickly fix the code. Atttached is the bare bones of the routine, where it easily covers both scenarios (blind as root and not as root in a linkedset) float chgBlindSize = (MAX_HEIGHT * ADJ_PERC) * dirMod;float chgChildPos = chgBlindSize;//if the blind is root we only need to move the child 1/2 the distanceif (IS_ROOT){ chgChildPos = chgChildPos/2;}float chgBlindPos = (MAX_HEIGHT * ADJ_PERC)/(-2 * dirMod);//by calling loc pos we either get global (for root) or relative (for linked)vector posBlind = llList2Vector(llGetLinkPrimitiveParams(LINK_THIS, [PRIM_POS_LOCAL]), 0);while (sizeBlind.z != newSize){ //Calculate values sizeBlind.z = sizeBlind.z + chgBlindSize; posBlind.z = posBlind.z + chgBlindPos; //Check if we have gone past the target size if ((sizeBlind.z > newSize && chgBlindSize > 0) || (sizeBlind.z < newSize && chgBlindSize < 0)) { sizeBlind.z = newSize; } vector posChild; //This is if we have a linked child prim to the blind to adjust its position if (CHILD_LINK != -1) { posChild = llList2Vector(llGetLinkPrimitiveParams(CHILD_LINK, [PRIM_POS_LOCAL]), 0); posChild.z = posChild.z - chgChildPos; } //Do the change llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SIZE, sizeBlind, PRIM_POSITION, posBlind]); if (CHILD_LINK != -1) { llSetLinkPrimitiveParamsFast(CHILD_LINK, [PRIM_POSITION, posChild]); }}
  14. Thanks Nova ... I knew that moving the root moved the linked prims, was just hoping that there might be a way around. Just have to manage that in the code then ...
  15. Nova, For the second issue I figured that likely that was it, and so since the code is meant to be general, i.e. I want it to work for the simple 2 prim blind scenario, as well as if the blind is linked to a larger set, then I assume I am going to have to use different code depending on if the blind prim is root or not. BUT .. what about the first pronlem I am having? i.e the blind is root and I am moving it as indicated and the child linked prims are moving as well ...
  16. Afternoon all, I have a situation that I am trying to get my head around and just cannot seemt ot get it clear, and ws hoping someone could point out the errors of my way :-) .. Basically I have two prims to create a blind, one is the blind and the other a bar across the bottom, with the script being in the main blind. When the blind is clicked it 'moves' up by reducing its size and adjusting position (top staying in the same place. While the blind moves upwards the bar moves as well. All works well and good when I have just the two, but my problems come when I want to link more prims, which should not move or when I link the blinds to another set of prims thus the blind no longer being root. In the first case the other prims (apart from the blind and the bar) move as well, while in the later the blind does not movve (resize) at all. I am using : llGetLinkPrimitiveParams(LINK_THIS, [PRIM_SIZE, PRIM_POSITION]) and lSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SIZE, sizeBlind, PRIM_POSITION, posBlind]) on the main blind prim to size and move it .... Any ideas as to what I am doing wrong? Thanks in advance! Wanda Soulstar
  17. Thanks revochen! Should have thought of that myself. In any case decided that since I am storing my data with seperators and then parsing to a list, knowing exactly the number of items that shoul dbe thee, if there are not its an entry I can ignore.
  18. Hi All, In a script I am working on I use the description field to store data for persistence across resets. On start up I basically do: string storage = llStringTrim(llGetObjectDesc(), STRING_TRIM); if (storage != "") { //Do some stuff with the data } else { //Do default stuff }Which is all well and good, except ... if a prim has been taken into inventory with nothing entered into the desciprion field, when it rezes again it now has (no description) in the dewscription field, and so the check for "" fails. I can obviously check for that string as well, but here my question: Does the value (no description) that is added to the prim when taken into inventory change depending on the language of the user/viewer, or is consistent? Thanks in advance!!! Wanda Soulstar
  19. Resolved .. Thanks Jinxui!!!! Hi All, I am looking or someone to create a custom fountian for my house. Basically is to have water flowing from a hole in the wall and lightly cascading into a pool below. I can show more or less what I am looking for exactly inworld. Of course expect to pay for the work :-) Please contact me inworld and I can show/explain what I am looking for. Thanks! Wanda
  20. Knew in the back of my mind it was something like that. Thanks All .. at least now I can move on :-)
  21. Hi All, Hopefully there is someone out there that can explain to me what I am doing wrong, or at the very least tell me 'That's the way it is' so I stop spinning in circles. My situation is this: Take any texture, does not have to be anything complex, just some simple cement for example.In GIMP use the Filter\Map\Tile feature and create a tile of three, so a 512x512 image becomes a 1536x512 image with three 'instances' of the original texture (same happens if I create a new image that is 1536x512 and copy and paste the original 3 times.If I then come into SL with the original image (512x512) and set a prim side to it, with a 3x horizontal repeat, and another same sized prim to the tiled version with1 (i.e no) repeat, the tiled version is blurred compared to the repeated version.This as well happens if the base image was 1024 x 1024. Any suggestions?
  22. Yep .. once I set HTTP Inventory things worked fine. I seem to remember that I disabled that option based on some other comment in the past as a way to improve performance ... and of course things do improve if no inventory is loaded and you are a cloud :-)
  23. For me this is still happening. My Inventory just shows as loading, cannot see anything in it.
  24. Dresden (or anyone) .. why the limit of 1500kbps, when I can set it as high as 10,000 in Singularity .. and when I test the speeds that I am getting based on the lins you indicated I have a download speed of 35-40 mbps?
  25. Ren - Yep have Singularity set at the highest Theresa - Realize that it is not a gaming laptop, but it is worlds better that the brick I had before. DD is set at 128m. If you were to see it from my desktop what you would see is all the mesh buildings, regular buildings, furniture, etc, with all their textures in .. and in a store a bunch of square or rectangular spaces (the sales signs) that are either grey, or more normally blurred .. that stay that way for ever.
×
×
  • Create New...