Jump to content

GManB

Resident
  • Posts

    237
  • Joined

  • Last visited

Everything posted by GManB

  1. Cute trick with the time... I love it!! rotation r = rotate(target_rot, llGetTime());
  2. Lucia, Thanks. That is some slick code :)! I will remember this. I did, with Rolig's help find a solution to my problem. Here's the snippet that did it: llClearCameraParams(); // reset camera to default llSetCameraParams([CAMERA_ACTIVE, 1]); llSetCameraParams([ CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive CAMERA_FOCUS, tablePos + <0,1,0>*tableRot, CAMERA_FOCUS_LOCKED, TRUE, CAMERA_POSITION, tablePos + <0.0,0.0,12.0>, // region relative position CAMERA_POSITION_LOCKED, TRUE // (TRUE or FALSE) ]); No matter what seat I sit in and no matter what the table/seats rotation around the z axis is the arguments to FOCUS positions the camera so that the view is: https://gyazo.com/03b5f4647dbcf7585eabf2f1a3b7fbae When an av sites in a seat the seat code asks the table for its position and rotation and puts them into tablePos and tableRot, respectively. The args to CAMERA_POSITION say to position the camera directly above the intersection of the local axes of the table and 12m up. It happened to turn out that the table's y-axis runs through player 1 and player 5 positions with +y toward player five's position. The args to CAMERA_FOCUS tell it (I don't completely understand this part yet) to point the camera at the intersection of the local axes of the table and modify the camera's rotation so that position 5 (+y) is at the top of the view and position 1 (-y) is at the bottom of the view. This is a bit more dynamic in that it doesn't matter the relative position of the seat to the table, the absolute position of the seat, or the rotation of the seat, or the table's position or rotation. Cheers, G
  3. Rolig, I will tried your code and it works as I expected it to. But it is not quite what I want. (It may be that it's all I can get though (seems there might be an appropriate Stones song, 'You can't Always Get What You Want')). Your code positions the cam relative to the object on which my av sits. And the orientation is looking straight down at the edge where I am sitting, whatever seat I choose. What I want is for the cam to have the same view no matter whatever seat I sit in. I always want the edge of player 1 at the bottom of the viewer.. Pic attached using your code for seat 8. What I want is for seat 8 to have the same view as seat 1. More thoughts. I understand now the difference between CAMERA_POSITION AND CAMERA_FOCUS. Thanks. However, isn't there a missing variable? Let's assume the camera is just another object and thus has axes, position, and rotation. I see how CAMERA_POSITION puts the origin of the camera axes at a particular location. Now, through which axis does the camera 'look'? I.e., which axis goes straight through the lens?. Let's assume it is the x-axis. (I think this argument applies whatever that axis might be). So I position the camera at x1,y1,z1 and point it at (FOCUS) x2,y2,z2 . They the camera's x-axis goes through that point, x2,y2,z2. Now, any rotation of the camera around its y or z axes would cause it to point at some location other than x2,y2,z2. I see this. And, we can say that the vector given to FOCUS *partially* specifies the orientation of the y and z axes in space. However, the camera *could* rotate around its x axis and still point at x2,y2,z2. Thus, giving a three-value vector to FOCUS does not completely specify the orientation of the y and z axes in space. It is this fourth variable I need to control. Staying with the x-axis through the lens. What I want is to be able to set the cam position directly above the center of the table with the x-axis straight down. Then rotate the camera around the x-axis so that the edge for seat 1 is at the bottom of the viewer. This may seem counter-intuitive but I've attached a pic of the view I want for everyone. There will be a fair amount of text in the white and black rectangles which is important for the player to read easily. Thanks, G
  4. Having a heck of a time with llSetCameraParams(). Consider an octagon shaped table. A player sitting at each edge. Player positions are numbered 1 through 8, increasing clockwise. Player specific info on the table reads properly when the edge at which a player sits is at the bottom of the viewer. Game specific info is all oriented such that it reads properly when player 1's edge is at the bottom of the viewer. As each player sits I want to move the camera directly above the table, looking straight down, oriented so that player 1's edge is at the bottom of the viewer. (I'd rather do it this way so every player can see the game info properly but, of course, their specific info will not be oriented as normal. However, every player has a separate hud with their specific info so for the table it's more important for a player to read the game info). I want to be able to position the camera no mater how an owner orients the table. This puts player 3 at the top and player 7 at the bottom. llSetCameraParams([ CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive CAMERA_FOCUS, tablePos, CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE) CAMERA_POSITION, tablePos + <0.0,0.0,12.0>, // region relative position CAMERA_POSITION_LOCKED, TRUE // (TRUE or FALSE) ]); This is about what I want but it only works with the table in a specific orientation. If I unsit, rotate the table, and sit the camera is oriented the same as before. llSetCameraParams([ CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive CAMERA_FOCUS, tablePos + llRot2Euler(tableRot*llEuler2Rot(<0.0,-PI/2,0.0>)), // region relative position CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE) CAMERA_POSITION, tablePos + <0.0,0.0,7.0>, // region relative position CAMERA_POSITION_LOCKED, TRUE // (TRUE or FALSE) ]); I don't want to have to require the owner to orient the table in a particular way. I don't really understand CAMERA_FOCUS and how it differs from CAMERA_POSITION. Any insights, helpful hints, pointers to docs (I have read what I can find), or questions for clarification welcome. Thanks, G
  5. Thanks Wulfie! A couple more things I noticed. If I sit my av while alt-camming: If I sit while alt-camming, as you say, cam doesn't chance. But if I then hit Esc, Esc. cam does re-attach, as expected, but in the position I have set with llSetCameraParams(). This is good. If I give movement commands to my av, with arrow keys, while alt-camming, the camera *does* re-attach. These two observations show the camera can be re-attached but what you are saying is that such re-attachment is *only* via the keyboard and not available to a script. If this is the case, then fine.. Given all this I assume the accepted behavior that ppl expect is that they control where the camera is attached, via alt-camming and (Esc,Esc) and thus would not be concerned that their cam didn't get positioned by the script while they have it detached via alt-camming. G
  6. I'm not sure I am using the right terminology here so please bear with me. I am trying to set the camera position to look straight down on a game table when an av sits at a chair. I'm currently experimenting with llSetCameraParams() and I believe I understand how to position the camera. However, this positioning doesn't seem to work when the camera isn't 'following' my av, or maybe this is called the 'default' camera position. If I use alt-click to position my camera to focus at a point then try my script, llSetCameraParams() has no effect. If I type Esc, Esc to return the camera to the 'default' or 'following' position then llSetCameraParams() works as I expect. Is there some combination of parmas to llSetCameraParams() to get it to work even if the av's camera isn't in the default or following mode? Thanks, G
  7. I got this suggestion from the Firestorm Support Group. And, yes, it worked. Odd to have to work w/o the outlines.
  8. Unfortunate Black Dragon is Windows only. Or, at least, I didn't see any downloads for MacOS. G
  9. The unmodified code works for me. Make sure you are not 'Editing' the info board when you attempt to touch it. Objects being edited cannot, from my experience, receive a 'Touch' event. Another thing I noticed is you have multiple tests like this. 'if (_option == "Notecard")' The string 'Notecard' does not appear in the list of strings you give to llDialog(..) and thus there will be no button with the label, 'Notecard'. E.g., instead of if (_option == "Notecard") { llGiveInventory(_id,"Booking Info"); } I think you want if (_option == "Boooking") { llGiveInventory(_id,"Booking Info"); } G
  10. I have a game table that is a pretty complicated linkset (because of all the prims needed to display text dynamically using FURWARE) that has an LI of around 100. I am working on it on a platform at 2k meters height so not much else going on around me. Normally my fps sits around 90 or so. When I select 'Edit' for the table the fps drops to about 9 or so.. even though I am not moving my cam around or anything. Just selecting Edit drops it so dramatically. I have a RaedonPro WX 9100 external GPU. I can deal with this but am curious about why it happens. And, ofc, if there is a way to minimize the drop I'd love ot hear about it. Thanks, G
  11. I have a linkset of 24 identical except for name objects. I have to make 7 of these. Each set of objects has a special name for each object. I create the set using a tool. But they need to be scaled. Once I have done the first I have the x,y,z values (for one of the 24 objects, ofc). But if I paste them into the next set only one of the 24 objects changes size. I know I can scale with the stretch option in build menu but that is quite fiddly to get each of the 7 sets exactly the same size. Can I select the linkset somehow or do something to I can paste in the x,y,z, values? Thanks, G
  12. I don't know the lsl functions well yet so I like to let Sublime auto-complete for me. Especially the arguments to a function. Super helpful at this point.
  13. Ok. How do you get a script from your system to in-world? Do you have to copy and paste it into a new Script? If I don't *start* with an in-world Script I cannot get Sublime to save to anything in-world. I would have to copy/paste. G
  14. You mean you create, modify, save all script files on your system's hard drive? If that's what you mean, how (and I know I'm probably missing something obvious here) do you get the scripts into SL? I cannot see any option in 'Upload' nor can I drag'n'drop the script to either Inventory or Contents. Also, does saving to your local hard drive also compile? Where is the compiler then? (I am using Sublime Text and I do not think its lsl support includes a compiler). Finally, how to you test using only local hard drive files? Seems there is some upload step. With Sublime Text and the ExternalEditor in debug settings set correctly when I click Edit in-world on the script I get it in ST and when I save in ST it's compiled and the bytecode goes to the asset store in-world. G
  15. A couple things. 1. You are editing from Contents. I had not thought of that since I moved to an external editor. That will save a couple steps in the modify/save-compile/test cycle. I just have to remember to copy the scripts back to Inventory when done. Just to mentally keep track of things. Right now I am editing from Inventory, saving, the deleting from Contents and dragging the new version from Inventory to Contents for each test cycle. 2. You probably already know this but you need 'utilities' in the same folder only so the preprocessor can find it. Once main is compiled the bytecode includes that from utilities and the entry in Contents is only a reference. So, you can remove utilities when the code is complete. G
  16. The docs say the pre-processor *will* look both in your hard drive using the path in the config, relative paths in the #include are ok AND will also look in the folder in your inventory in which the file having the #include is in. I have found that both work just as described in the doc. The only observation I made not in the doc is if you are including a script from inventory do not add '.lsl' at the end. Just the displayed name of the script. G
  17. There is something about that in the docs. They say if the last line of the file is a #endif you need the extra line. But, the last content line in the utilities file is '}' and I do put empty lines after, tried one, two, lots... always the same error and always on the last line whether it is empty or not. G
  18. I am including a script file in another file like this #include "utilities" utilities is a script file in my inventory in the same folder as the file which includes it. (also, note, I am using an external editor, Sublime Text) When I make a chance to the utilities script and save it I get a compile error. Always the same always the last line of utilities. Simple syntax error at line position 0. When I save the file that includes utilities it compiles fine. Is this a known bug? Is there a workaround? Or, is there a way to save a file w/o invoking the compiler? Thanks, G
  19. DoteDote, I think the only way to accomplish what you suggest would be to modify the FURWARE code. I'd prefer not to have to maintain a separate version of that. G
  20. I am more confused. From the LSL String page: http://wiki.secondlife.com/wiki/String 'But note that in Mono, strings use UTF-16 and occupy two memory bytes per character.' ------------------------------------------------ From the UTF-16 Wikipedia page: https://en.wikipedia.org/wiki/UTF-16 The encoding is variable-length, as code points are encoded with one or two 16-bit code units. Number of bytes First code point Last code point 16-bit code 1 16-bit code 2 2 U+00000000 U+0000D7FF xxxxxxxxxxxxxxxx 2 U+0000E000 U+0000FFFF xxxxxxxxxxxxxxxx 4 U+00010000 U+0010FFFF 110110xxxxxxxxxx 110111xxxxxxxxxx -------------------------------------------------------------------------- So, if LSL/Mono follows the UTF-16 specification a character needs either two or four bytes in the raw binary values of the string. Thus, for any string S GetStringBytes(S) should equal 2 * llStringLength(S) (that is, if GetStringBytes is attempting to return the number of bytes in the binary memory representations of S) That llStringLength("KT Kingsley") returns 11 makes perfect sense since the doc says it returns an integer whose value is the number of characters in the string. No disputing of confusion with this. That GetStringBytes("KT Kingsley") also returns 11 seems not to square with the documentation for String in LSL and UTF-16. It could be, however, that LSL is either optimizing memory usage and violating the UTF-16 spec OR, more likely, I think, is really using UTF-8 (which allows for 1,2, 3, or 4 bytes to represent a single character). In KT's code I changed the while loops body to be string character = llGetSubString (message, index, index); string character_base64 = llStringToBase64 (character); integer ordValue = Ord(character); integer character_base64_integer = llBase64ToInteger (character_base64); llOwnerSay (character + ": " + character_base64 + ", " + (string) character_base64_integer + " : OrdOutput : " + (string)ordValue); ++index; I added the call to Ord() for each character and output it's value. The output is what one would expect. E.g., Ord("A") returns 65. I think the test I will do is to loop through the characters of the display name (as shown by KT) and check that the output of Ord() is between 32 and 126 (the printable ASCII characters. If any character fails the test then use the user name. I don't mean to belabor this point, really, I am just trying to learn as much about the underlying LSL execution engine, memory model, etc. as I can. So this thread has been a great learning experience. Comments welcome! G BTW, in writing this I seem to have, at least slightly, un-confused myself
  21. Wow! This is great! Always helps to ask :)! Reading the doc, yes, looks like every other pre-processor. G
  22. Well, even something like a simple #include <filename> would be nice. (The pre-compiler just inserts the named file(s) at the location of the #include). We could at least put all helper, utility, etc. functions in other files. My one script is getting toward 500 lines and a bit awkward to have to scroll around. Multiple files would at least allow us to have multiple tabs/windows at positions in the code which we might want to look at frequently. Anything like this? G
  23. Just wondering. I haven't seen any mention of how code in one scrip might reference a function or variable in another script. Is there a straightforward way to do this in lsl? Thanks, G
×
×
  • Create New...