Jump to content

JS to LSL help


Yoshimaster96
 Share

You are about to reply to a thread that has been inactive for 3466 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

1.  You can't.  You can check to see which key was pressed if your script happens to be looking for the small number of keys that are defined for a control event.  And you can of course determine that any of the alphanumeric keys must have been pressed after you have entered text.  But you can't determine that the user touched a key somewhere at random.  When an action is sensed during an LSL event, it does not interrupt the event.

2. All system functions (those starting with "ll") are listed in the LSL wiki.  Yoiu can create user-defined functions either within the scope of individual events or for global use at the head of your script, outside of the states.  Several user-defined functions have been contributed by the scripting community and can be found at http://wiki.secondlife.com/wiki/Category:LSL_User-Defined_Functions

3.  You can't alter a texture bitmap dynamically.  You can replace it with another texture, you can stretch or rotate it, you can move it around on an object, and you can change characteristics of the surface that it is on (by changing color, transparency, glow, etc.), but you cannot alter the texture itself.

If you are unfamiliar with LSL scripting, you should probably devote a small amount of time to one or two tutorials.  Your prior experience with JS or C++ may help a lot, but may also lead you to expect some behaviors that are not possible in LSL.  Pay particular attention to the concept of states and events.

  • Like 1
Link to comment
Share on other sites


Yoshimaster96 wrote:

  1. Yes, I want to see which key is pressed. Sorry I wasn't so specific.

[ .... ]

In that case, take a look at the link I provided to the LSL wiki page for the control event. You can detect key press on the specific keys in the table on that page (WASD or the keyboard arrow equivalents, plus PgUp, PgDn, and LBUTTON or MLBUTTON).  You cannot detect key press on other keys.

Link to comment
Share on other sites

You're asking increasingly complex questions a little bit at a time, so it will be increasingly hard to answer. As a start, I suggest reviewing basic functions for locating and moving objects.  You'll find links at http://wiki.secondlife.com/wiki/Category:LSL_Movement  .  Location is always defined either relative to the regional grid (global coordinates) or relative to a specific point (local coordinates).  Translating from one to the other, assuming no rotation, is simply a matter of calculating the vector llGetPos() - Reference_Position, where llGetPos is a system function that returns the global position of the object and Reference_Position is the global position vector for whatever you have selected as your reference point. 

Once you start dealing with potential rotations of the object or the reference system you have chosen, life gets complicated very quickly.  That's not a topic to explore in a few quick forum posts.  Begin with http://wiki.secondlife.com/wiki/Rotation and expect to use your math skills for trigonometry and matrix algebra, plus a lot of practice. 

 

Link to comment
Share on other sites

Start here >>> http://community.secondlife.com/t5/English-Knowledge-Base/Build-Tools/ta-p/700039

You don't "draw" a cube.  This is not Unity.  You either generate and manipulate a set of standard mesh objects with the Build/Edit tool in your viewer or you use an external 3D modeling program like Blender or Maya to create custom mesh objects that you then import into SL.  You can use LSL scripts to generate objects and then move and modify them so you don't need to do it manually, but most building in SL is not done by scripts.

It sounds to me as if you are trying to start in Second Life without having taken time to learn some of the basics. Maybe now would be a good time to step back and do that.  Start here >>> http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Quickstart/ta-p/1087919  .  Then consider spending time with the excellent tutorials at the Caledon Oxbridge University in world (find it with your Search tool).  Once you have done that, explore possible free classes in building, scripting, and other creative fields at Builder's Brewery (find also with Search).

Link to comment
Share on other sites

Slow down there, cowboy. And welcome to Second Life!

As Rolig says, there's a lot of baby step stuff to learn before you go galloping off across the grid. You don't draw anything in SL. You only manipulate 3D objects that have already been created, either in-world with the build tools, or out-world with 3D creation tools like Blender. There are tricks, like rezzing a cube, then telling it to be a sphere, or rezzing a sculpted object and swapping between preloaded sculpt maps, but you cannot generate shapes algorithmically in LSL (other than perhaps Lego wise, but that will eat up prims in a heartbeat, and you must learn about Land Impact).

Rolig gave you some things to read. Go through those materials or you will keep coming to us with what appear to you (and to anyone new) to be simple questions that require us to give very long answers with lots of background that can be gleaned from the Wiki and Knowledgebase. SL has quite a learning curve. If you love to learn, you'll be a happy camper. If you have a specific goal to achieve by Friday, uh oh.

;-).

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3466 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...