DonnaMitchell Posted December 19, 2018 Share Posted December 19, 2018 Hello all, I am in the process of scripting a boat. I've gotten everything sorted so far except for how to make the boat move sideways. I've seen some boats do this with the SHIFT+LEFT/RIGHT and the script I have that came with a boat that does this, I can't seem to find where in the script that allows this. Both this script and my script seem to have the same lines of script for moving the boat. Any help would be appreciated. Thanks. Link to comment Share on other sites More sharing options...
Rolig Loon Posted December 19, 2018 Share Posted December 19, 2018 in the control event, you just need to define what happens when you hold down one of the keyboard's <- or -> arrow keys. You already have definitions for the forward and backward keys. 1 Link to comment Share on other sites More sharing options...
DonnaMitchell Posted December 19, 2018 Author Share Posted December 19, 2018 that's where im stuck...im just not sure what the definitions are... control(key id, integer levels, integer edges) Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted December 19, 2018 Share Posted December 19, 2018 (edited) 40 minutes ago, DonnaMitchell said: that's where im stuck...im just not sure what the definitions are... control(key id, integer levels, integer edges) You might want to read up on the wiki page on what kind of constants you can use in your key checks. http://wiki.secondlife.com/wiki/Control Edited December 19, 2018 by Wulfie Reanimator 1 Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted December 19, 2018 Share Posted December 19, 2018 The keys are often defined using constants. For example, CONTROL_LEFT and CONTROL_RIGHT are the constants used when referring to the key press SHIFT+LEFT and SHIFT+RIGHT respectively. You can find a list of all the control constants on the wiki. Here's the control event page. Generally speaking, when a control event is processed, it starts out with those three variables "id", "levels" and "edges" being populated with information as outlined in the wiki. Think of it as a snapshot taken the instant any key is pressed. Id is the key of the avatar currently controlling the script (read: who has given permission for the script to act on their inputs). Levels and Edges are integer bitfields which together can be used to determine the exact status of all keys at once (integers are 32-bits long, and each bit is being used as a sort of on/off flag assigned for each key). This status can tell you if the keys have just started to be pressed, are currently being held down, have just been released, or haven't been touched at all. By performing logical operations on these two variables in conjunction with one of the control constants, you can suss out meaningful status for a given key. 1 Link to comment Share on other sites More sharing options...
DonnaMitchell Posted December 19, 2018 Author Share Posted December 19, 2018 ok, looks like I am getting somewhere...apparently the CONTROL_LEFT and CONTROL_ROT_LEFT were lumped together as was the RIGHT. I separated them now and have this.... if (edges & levels & CONTROL_LEFT) { } else if (edges & ~levels & CONTROL_RIGHT) { } else { } 3 Link to comment Share on other sites More sharing options...
Rolig Loon Posted December 19, 2018 Share Posted December 19, 2018 10 minutes ago, DonnaMitchell said: apparently the CONTROL_LEFT and CONTROL_ROT_LEFT were lumped together as was the RIGHT. What you are missing yet is the stuff that goes between the { curly brackets } after your if statements. By studying the similar blocks of code that define what happens with CONTROL_FORWARD and CONTROL_BACK, you ought to be able to figure out similar language for moving left or right. 1 Link to comment Share on other sites More sharing options...
DonnaMitchell Posted December 20, 2018 Author Share Posted December 20, 2018 Thanks for the replies. Now I just need to figure out what goes between the brackets, but my main question has been answered. I just needed to know what CONTROL was needed for moving sideways. Link to comment Share on other sites More sharing options...
Recommended Posts
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