17:13] Antonius: Hello!
17:14] Sasha: hi
17:14] Antonius: and welcome
17:14] Sasha: ty :)
17:15] Antonius: Hi Caitna!
17:16] Antonius: Hi & welcome!
17:16] Caitna: Hiya :-)
17:16] Caitna: I actually made it this time! Been wanting to for ages
17:16] Antonius: So how are you both doing this evening?
17:16] Sasha: I am fine!
17:16] Antonius: I'm glad you could make it.
17:16] Sasha: Just got moab pro last night :)
17:17] Antonius: Yes. Thanks for that! Really appreciated. Have you used the free version much?
17:17] Caitna: I've had it for ages, but haven't used it much yet, and I need to get started using it :-) I know enough about scripting to know that MoaB was a MARVELOUS package for me
17:17] Sasha: A little
17:17] Caitna: I opened a couple of the demos with the free version, and knew right off it was exactly what I needed
17:18] Sasha: I decided to buy the pro version before getting too involved in it tho :)
17:18] Antonius: Caitna, is your experience with scripting/programming in general or with LSL?
17:19] Caitna: Not much at all with LSL, one reason I decided I needed a package that would let me do things primarily visually
17:19] Caitna: I've scripted for Neverwinter Nights for many years, but it's a linear/single thread script language
17:19] Antonius: Yes & MOAB will help here. You do still need to understand the basics of LSL in terms of variable types and control statements such as if..then..else. See: http://bit.ly/OXo4Nb
17:20] Caitna: So the multithread/parallelism in LSL is proving difficult in the "getting my thoughts in order and doing a rough outline" stage
17:20] Caitna: /me nods "MoaB's links to the lsl wiki on functions was definitely something I took note of in a positive way :-)
17:21] Antonius: Well as far as parallelism is concerned, remember that each script is a single process in effect, that is driven by events from the world.
17:21] Caitna: /me nods
17:21] Antonius: Only when you start to group together scripts to build a larger project do you get into the multi-threaded issues.
17:22] Caitna: I've been digging into UML info on the net, as it seems to be set up very similarly to MoaB
17:22] Antonius: Yes, I took a subset of UML, the state machine part, and used that in MOAB. See: http://bit.ly/Ul4FK9
17:23] Caitna: there's a fair amount of stuff available on using UML so I can sort of look up as I go along :-)
17:23] Caitna: Excellent, that will help me a lot :-)
17:24] Antonius: At some point I'd like to expand and add a bit of the structure part of UML to MOAB so that you can capture multiple scripts within MOAB and have MOAB generate the communication code. It's ambitious but doable.
17:24] Caitna: THAT would be marvelous :-)
17:24] Antonius: Have you both gone through the online documentation for MOAB?
17:24] Sasha: yes
17:24] Caitna: briefly, and a while back, but I can follow along fine I think
17:25] Sasha: I went thru and made the tutorial door from scratch
17:25] Antonius: Excellent Sasha!
17:25] Antonius: There's lots of info there on how to use the individual modeling concepts.
17:25] Caitna: /me nods "MY problem is the very first steps
17:26] Antonius: I have some getting started info on the online documentation
17:26] Antonius: Let's see if I can bring it up here...
17:27] Antonius: Maybe take a seat so that you can see this better.
17:28] Antonius: This is the main page of the documentation.
17:28] Antonius: If you haven't done this Caitna, start from the Start Here section.
17:29] Caitna: Yes, I went as far as midway into the tutorial light switching script
17:29] Antonius: The 10 Steps to Creating Your First MiceOnABeam Script should help you get started.
17:29] Antonius: Ok that's great then.
17:30] Caitna: It's more... ok, I have an idea I want to write a script to do: switch panoramas in sync across 9 different object faces, but can be easily expanded by a secondary user, so, probably a NoteCard Config
17:31] Caitna: It needs to work across a single linkset, but not interfere with similar scripts running in an arbitrary number of linksets in the vicinity... So... where do you start in terms of basic organizing a project?
17:31] Antonius: Well you should definitely take a look at the door tutorial since it shows you how to setup reading a notecard in MOAB.
17:32] Caitna: A way to look at it and figure out how many and what sort of states, etc. And yes, a pointing to a resources is as good as an explanation *blushes*
17:33] Antonius: Well sometimes people have trouble getting started because the project they want to do is fairly large.
17:34] Antonius: I always recommend starting with some smaller part of the project and build up from there. Step by step. At each step, you test things out, correct errors, etc. Then when that part works, you add in the next set of features.
17:34] Caitna: There, bookmarked. And, heh, I suspect I'll end up with a fair bit of fancy in this :-)
17:34] Caitna: /me nodsnods
17:34] Antonius: That's the way much software development is done.
17:34] Caitna: I tend to like the modular successive refinement approach myself, so this is good :-)
17:35] Antonius: Yes that's exactly right Caitna.
17:35] Antonius: So for your project, you have to first define some basic behavior that you'll start off with.
17:38] Antonius: I would first tackle displaying a texture on a single prim and changing it as per your requirements. Then link a second prim to work in sync with it. You'll have to decide on a communication scheme, perhaps for a master prim that takes the user command and either sends link messages the other prims to set the texture or preferably uses llSetLinkPrimitiveParamsFast to do the job (relevant child prims would have had to identify themselves to the master during initialization in this case)
17:35] Caitna: Is the "least active" state the best to do for a base state?
17:36] Caitna: Or the state that it sits in for the most time?
17:37] Caitna: ie, on rez, I expect it to usually be "powered down", windows closed, scenery dark. Then, when you turn the environment system on, the windows open up and there's a scene, and a bit of lighting... and it waits for you to tell it to change the scenery
17:37] Antonius: Remember that states are just points in time when the script is waiting. It has finished processing it's current event and is waiting for the next one.
17:38] Caitna: /me nodslistens
17:39] Antonius: Ok, so yes, there's often a state after on-rez, that results in some script resetting or initialization.
17:40] Antonius: After that if you're waiting for use input, then you would have moved to another state for that.
17:41] Caitna: ok *nodslisten*
17:41] Antonius: Sometimes features will cycle you through a set of states and then return you to the wait-for-user-input state.
17:41] Antonius: I think I should show you an example. Hold on.
17:41] Caitna: /me nods again and works on applying that
17:43] Antonius: Ok so this is the Secure Door model that's covered in the video tutorial.
17:43] Caitna: /me works on following things
17:44] Antonius: Note that on script initialization or on rez, the script will re-read the notecard, leaving and returning to the state for each line read.
17:46] Antonius: To read a notecard, you have to wait for dataserver event which provides one line of data at a time.
17:44] Antonius: Once the notecard has been read, it moves to the Closed state.
17:44] Antonius: In this case the notecard contains the names of avatars authorized to enter through the door.
17:44] Caitna: hmm... ok, why is that better than just doing it inside the state?
17:45] Antonius: What do you mean inside?
17:46] Caitna: /me thinks * right, right. I'm too used to linear... the states are mostly just traffic signs for the program flow, the actual wiork gets done in the connections, more or less the opposite to "normal" old style flow charts,. Sorry
17:47] Antonius: Yes they are sort of traffic lights or stop signs, where you have to stop, and wait for some signal (i.e., an event) in order to continue.
17:47] Caitna: /me nods
17:48] Caitna: I'm picking it up :-) It's a very different design philosophy, but much better
17:48] Antonius: In this case the ReadNotecard state has to wait for the dataserver event. Once it receives that event, it process the data supplied in the event, and then returns back to the ReadNotecard state to fetch another notecard line.
17:49] Antonius: Sasha, are you following along ok?
17:49] Sasha: just fine :)
17:50] Caitna: Anwyays, so, in this case, the entry code is the GetNextLine action, then the exit code is the dataserver response/return?
17:51] Antonius: Action code can be in *either* the transition or in the state itself as Entry Code or Exit Code. The former gets executed *every* time the state is entered, and the latter is executed *every* time the state is left.
17:51] Antonius: So in this case the ReadNotecard state has Entry Action code that makes an ll function call to read a line from the notecard and then sits and waits for SL return with a dataserver event with the data.
17:51] Caitna: But in terms of the charting, they're considered to be part of the transition, not the State?
17:52] Antonius: No, they're considered to be part of the state, and fall within that state's variable scope in fact (if it had any State Variables).
17:53] Caitna: OK, good, yes, variable scope was why I was asking :-0
17:53] Caitna: scope mismatch on variables can cause you more trouble... urgh
17:54] Antonius: Yes you can define variables for each state or Composite State with all the states contained within the latter having access to the Composite State's variables. The Top State is basically a Composite State.
17:55] Antonius: So the scope is hierarchical corresponding to how you nested your states.
17:55] Sasha: global
17:55] Caitna: /me nods "Just meant, that's why I wanted to be sure about the "location" of the entry and exit points
17:55] Antonius: Right. Note that nested states should be used sparingly; only when there's some common event that you need to factor out, or for hiding the details of the implementation which makes for a much clear model diagram.
17:57] Antonius: Sasha, so yes variables defined for the Top State are in effect global to the design. You can also define globals with the Custom Globals menu option in the Script menu.
17:57] Caitna: well... like in my case, I was figuring a per room variable for the label of the panorama view that is in place, and a global for the room Power on/power off state
17:58] Antonius: Caitna you will find that some key variables that you would traditionally use, become actual states in an event driven model.
17:59] Caitna: *thinks and then* Ahh, ok, yes, like, power on and power off
17:59] Antonius: In general a program's "state" is the value of all it's variables at a given point in time.
17:59] Caitna: in power off, the only signal it waits for is to turn on, in on, it has multiple control options, so it would be a state, not a variable to be checked
17:59] Caitna: OK, got it
18:00] Antonius: So what you can do is think of the most important variables that you would think of having, and perhaps these may become actual states in the MOAB model.
18:01] Antonius: Yes, Power Off and On seem like reasonable states to have.
18:01] Caitna: Hmmm
18:01] Antonius: The On state can then have the feature stuff inside it.
18:02] Sasha: as the off state does not need it
18:02] Sasha: ?
18:02] Caitna: and, since when the new textures get applied and rez, the windows will close and I'll likely put some sort of special effects/lighting stuff, then reopen... that would be a State as well
18:03] Caitna: As a nested state... inside "On" state, so that the variable in "On" for the panorama, will carry down into the "change scene" state"...?
18:03] Antonius: Depends what events the Off state has to respond to. If it's a single event that moves it to On, then it's probably not a Composite State.
18:05] Caitna: I'd think Off wouldn't be, but the On state would have control inputs to read and then to move into the change state, and then back out to the On state... is there an easier way to carry vars between scopes than nesting?
18:05] Caitna: /me blushes "Or do we want to stick to the door example for now Sorry, didn't mean to monopolize things
18:07] Antonius: You can't explicitly check the state you are in if you are a substate, but this should be self evident, as a substate can only be within one outer state. Of course that outer state itself can be within another one and so on,
18:08] Antonius: If a var has to be common to more than one scope, then move it up higher in the hierarchy, possibly to the highest level, the Top State or Custom Globals.
18:09] Caitna: hmm... *nods* OK, I think I've got the logic there
18:09] Antonius: Again, Composite States should be used sparingly. You will find that most of your variables are either at the Top level, or defined in states at the next level down.
18:10] Caitna: yeah, I was thinking next level down, but, if I make the panorama label global, it would set (or perhaps read and set?) the "Current" panorama label
18:10] Antonius: To complete the door example shown, once the notecard has been read, the script moves into the Closed state where it *waits* for a touch event.
18:11] Caitna: touch end is the "click" to select event, yes?
18:11] Antonius: Yes, when you click on a prim, it generates a number of touch events. I use the touch_end event here.
18:11] Caitna: ie, when the left mousebutton is released
18:12] Antonius: Yes.
18:12] Caitna: Safer, lets you option out by sliding off it before you release the mouse button
18:12] Caitna: Instead of "oh drat I clicked the wrong thing" XD
18:13] Antonius: The touch_end event is then processed, and you're led to a Choice Point which checks the data from the event, i.e. who did the touching, and checks it against the list of avatars previously read from the notecard.
18:14] Caitna: Relatively simple list parsing functions available?
18:14] Antonius: In this model this list is clearly global since it has to be accessed across the model.
18:14] Caitna: /me nods
18:15] Antonius: LSL is a fairly primitive language. You can do a few things with a list like search, delete, insert. Not much else.
18:16] Caitna: /me nods "Okies. That sucks LOL> I'm used to doing bitmap variable access XD
18:16] Antonius: If the avatar's name was found on the list, then the script proceeds to the Opened state, and waits there, *either* for another touch event or a timeout event both of which will return the script to the Closed state and close the door.
18:17] Antonius: In the Entry Code of the Opened state, I have code that starts up a timer. In the Exit Code of the state I cancel the timer.
18:17] Caitna: Out of curiosity, is this setup such to break something if a touch end and a timer expiration both happen at the same time?
18:18] Caitna: It's obviously not a security issue, since anyone that dedicated can just cam around, but, I'm wondering to what level do I have to worry about good error-trapping?
18:18] Antonius: No, in fact multiple events can always happen at the same time. The SL run-time system maintains it's own queue or list of events that are waiting to be processed by the script.
18:19] Antonius: Only *one* event is processed by a script at a time, and that processing *cannot* be interrupted until the event processing has completed.
18:20] Sasha: the event queue
18:20] Caitna: So it's not going to happen LITERALLY simultaneously regardless of when they're triggered... a single cycle difference is imperceptible to a person, but the computer knows the difference perfectly well
18:20] Antonius: So if the timer & touch events came in at the same time, one will be put in the event queue (right Sasha!) first followed by the other one.
18:20] Caitna: whispers: So, cooperative multitasking, with good queue control, Has good points and bad points, but in THIS case it's a Good Thing :-)
18:22] Antonius: If touch came in first then the script would process that and move to the Closed state. At that point the MOAB model will get the timer event, but since there is *no* transition that leaves the Closed state with the timer event set for it, the timer event will then be ignored.
18:22] Caitna: /me nods Excellent
18:22] Antonius: Now if it was the other way around, the timer event was put first in the event queue, then yes, in Closed you would then process the touch event and move back into the Opened state!
18:23] Sasha: as we have all seen happen :)
18:23] Sasha: close..OPEN!
18:23] Antonius: If you didn't want that to happen, then you would have to put in some de-bounce code that would ignore the touch in the case where it came too soon after the timer event.
18:24] Antonius: So true Sasha! That's why I put in debounce code in my new MOAB Universal Door, so that multiple touches will not open/close the door.
18:25] Caitna: I'm thinking probably not worth the effort for this, but might be in some situations
18:25] Caitna: ahh, well, if YOU wanna put the work in XD
18:25] Sasha: :)
18:25] Antonius: Yes. Which reminds me, would either of you like a free MOAB Rotator or Slider?
18:25] Sasha: yes!
18:25] Caitna: Thogh I suppose No TP areas make it relevant well enough
18:25] Caitna: /me smiles "I actually bought them both already XD
18:26] Caitna: But thanks! :-)
18:26] Sasha: The rotate for me plz
18:27] Caitna: Well, as it stands, there's only so much use "security" can be, because someone can Cam whereever they want, and unless the region is set to disallow TPs, or to have a single access point only, they can just double click right past any doors
18:28] Caitna: But if the place is set to disallow free TPing, it might be worth it for a really secure door
18:28] Antonius: Oh I see.
18:29] Antonius: Caitna did you buy the copy versions?
18:29] Caitna: /me gigles "Not one of the strangers that have wandered into my house have used the door to get there XD
18:29] Caitna: Yep! :-) I wanted them to build with :-)
18:29] Caitna: so they're Copy/Trans OK :-)
18:29] Antonius: Ok.
18:30] Antonius: Sasha do you want to try out the MOAB Role Play Door here?
18:30] Sasha: nah
18:30] Caitna: THAT looks very cool by the way
18:30] Antonius: It's bashable!
18:30] Sasha: I just TP thru doors
18:30] Sasha: /me giggles
18:30] Antonius: Just set yourself to run.
18:30] Sasha: or cam
18:30] Caitna: Most people just TP through doors :-)
18:31] Antonius: Hmm. You don't have much mass :-)
18:31] Caitna: Can you set them to respond to key items in inv? That sounds like a massive parsing job...
18:31] Antonius: There you go.
18:31] Sasha: ouch
18:31] Antonius: It works with projectiles too.
18:31] Antonius: lol
18:32] Antonius: I will help. It works with multiple people bashing it too.
18:32] MOABUniversalRPDoor V1.0.0: Damage increased by 29.31 %
18:32] MOABUniversalRPDoor V1.0.0: DOOR BASHED OPENED!
18:32] MOABUniversalRPDoor V1.0.0: Automatic partial repairs completed: 10 %
18:32] Caitna: I love the lockpicking thing, VERY cool
18:33] Antonius: It's now bashed open so people can walk through.
18:33] Sasha: door fail
18:33] MOABUniversalRPDoor V1.0.0: Automatic partial repairs completed: 10 %
18:33] Caitna: One thing, as far as universality of doors.... iris doors are a type this doesn't have
18:33] Antonius: Authorized people can then repair it.
18:33] Sasha: will it regen over time?
18:33] Antonius: Yes it does iris doors too.
18:33] Caitna: That's EXTREMELY cool for roleplaying areas *nodsnodsnods*
18:34] MOABUniversalRPDoor V1.0.0: Partial repairs completed: 10 %
18:34] Caitna: ohh! You should include that in the ad copy. I Looked :-)
18:34] MOABUniversalRPDoor V1.0.0: Automatic partial repairs completed: 10 %
18:34] Antonius: Yes, you can set it for automatic repairs.
18:35] Caitna: I do have hopes of building Roleplaying areas eventually, so that's a VERY cool feature
18:35] Antonius: It's in there! It lists all the door types it can do.
18:35] MOABUniversalRPDoor V1.0.0: Automatic partial repairs completed: 10 %
18:35] MOABUniversalRPDoor V1.0.0: Partial repairs completed: 10 %
18:35] Caitna: Ahhh! There it is! :-)
18:35] Antonius: You can of course customize all the timeouts
18:35] MOABUniversalRPDoor V1.0.0: Partial repairs completed: 10 %
18:35] Sasha: :)
18:35] Sasha: cute
18:36] Antonius: It can also be lockpicked and you can get a key for the door.
18:36] MOABUniversalRPDoor V1.0.0: Partial repairs completed: 10 %
18:36] Caitna: VERY cool. Is there sound support? though frankly not real high on my priority list
18:36] MOABUniversalRPDoor V1.0.0: Automatic partial repairs completed: 10 %
18:37] Second Life: Items successfully shared.
18:37] MOABUniversalRPDoor V1.0.0: Automatic partial repairs completed: 10 %
18:37] MOABUniversalRPDoor V1.0.0: whispers: DOOR FULLY REPAIRED!
18:37] Antonius: Yes sound too. I sent you the key Sasha, Wear it.
18:38] Sasha: thats a BIG key
18:38] Antonius: Yes. lol
18:38] Caitna: Did it actually clean the rubble up and my display is just horribly lagged (Which it seems to be)
18:38] Caitna: Ahh, ok, I caught up. that is EXTREMELY cool
18:39] Antonius: It's supposed to clean up the rubble. I think I may have found a bug :-(
18:39] Caitna: Ahhh. Heh
18:39] Antonius: That shouldn't happen.
18:39] Caitna: Yeah, the rubble cleaned up, my redraw was just slow
18:39] Sasha: I broke it
18:40] Sasha: LMAO
18:40] Antonius: Yea!
18:40] Sasha: now its jammed
18:40] Sasha: kinda cool
18:40] Caitna: One thing I have issues and problems with, is that for vehicles, everything MUST be in a single linkset
18:41] Antonius: It can be linked no problem and still works.
18:41] Antonius: Rotated too. No path cuts required too.
18:41] Caitna: oohhhhh
18:41] Caitna: Can you trigger the "damaged/stuck" state by a remote signal?
18:42] Caitna: the NovaTech TARDIS system has a script package that among lots of other things, you can induce damage/malfunciton states via script
18:42] Caitna: it would be very cool if the Doors all got stuck, or some at random got stuck, from entering the tardis wide "Damaged" state
18:43] Antonius: No. I could add that. There is a MOAB Door Server you can buy from which you can control the door. You can open/close, lock and unlock. I could add Damage to that too.
18:43] Antonius: The server's neat too since you can wear it as a hud and use it to teleport to all your doors on the sim.
18:44] Antonius: Well I think I've run out of time tonight. I hope you both found it useful!
18:44] Sasha: Well i must go. this has been most informative
18:44] Antonius: Thanks so much for coming!
18:44] Sasha: Thanks Ant!
18:45] Antonius: If you have any questions you can always IM me or send an email to firstname.lastname@example.org
18:46] Caitna: Will Do :-) Thanks so much!
18:46] Caitna: /me smiles and goes to play XD
18:46] Antonius: My pleasure Caitna. See you again soon.
Entries in MiceOnABeam User Group (27)
17:13] Antonius: Hello!
[17:13] Chef Pilot: Hey boss
[17:14] Chef Pilot: What's happening?
[17:14] Antonius: Hey Pilot.
[17:18] Antonius: I've enhanced your elevator script.
[17:19] Chef Pilot: Looks like you've done a lot of work to it mate.
[17:20] Antonius: Well when a customer asked for your elevator script, I took a look & it was a neat concept using physics to move the elevator.
[17:20] Antonius: So I just built on that to create this one. Did you get the group notice with the link?
[17:21] Chef Pilot: Ahhhh, yeah...
[17:21] Chef Pilot: Yes, as a physical object moving, an avi doesn't have to sit on it.
[17:21] Antonius: Yes exactly! That was what was so neat about it.
[17:33] Antonius: Ok. So why don't you download the model & open up MOAB so we can review. (Download: http://bit.ly/whEQzz)
[17:35] Antonius: Let me know when you have it loaded.
[17:46] Chef Pilot: Stone the crows!!! You've certainly done some work on it!
[17:47] Antonius: A little. :-) But the basic concept remains.
[17:47] Antonius: Ready to review?
[17:48] Chef Pilot: Sure, got it opened up and just looking at the code.
[17:48] Antonius: Ok. An overview first. (http://screencast.com/t/WQ87qVKDrT2)
[17:49] Antonius: We start up and take the Initial Transition to the WaitForCall state.
[17:49] Antonius: Here, we wait for a touch-end event which brings us to the ShowMenu state to display a dialog.
[17:50] Chef Pilot: yep
[17:50] Antonius: Note that ShowMenu is one of the built-in components in MOAB.
[17:50] Antonius: A menu is displayed which displays a selection of floors to choose from.
[17:51] Chef Pilot: yes
[17:51] Antonius: From there the listen event brings us to the Choice Point C.
[17:52] Antonius: If the Reset button was selected we want to re-initialize the elevator. For simplicity, it automatically defines the Ground Floor at the current position.
[17:52] Antonius: So if you move the elevator platform around, you select Reset to set it at it's new location. (This function of course can be redone in a different way to make a cleaner dialog.)
[17:53] Antonius: Note that the Reset transition goes to the border.
[17:53] Antonius: Do you recall what this does Pilot?
[17:54] Chef Pilot: That takes us outside
[17:54] Chef Pilot: But we are at the lowest level....
[17:54] Antonius: Well in this case notice that it is a small shaded circle on the border, meaning that it is not connected to anything outside.
[17:55] Antonius: We are actually at the highest level, the top state.
[17:55] Chef Pilot: So that takes us back through init()?
[17:55] Antonius: Exactly!
[17:55] Antonius: By George he's got it!
[17:55] Chef Pilot: Highest level, lol......
[17:59] Antonius: Ok. So we go back through the Initial Transition to the WaitForCall state.
[17:59] Chef Pilot: Ah :)
[17:59] Antonius: If Reset wasn't selected then one of the floor buttons was, so we continue on to the MoveToFloor state.
[18:00] Chef Pilot: nods
[18:00] Antonius: Before discussing the code in MoveToFloor, let's look at the State Variables & Functions defined.
[18:01] Antonius: See the screen or open up the State Variables & Functons editor for the top state. (http://screencast.com/t/6rTkyhJftG1a)
[18:02] Antonius: There are two variables that need to be configured. FloorNames is a list of strings that contains the names for the buttons.
[18:02] Chef Pilot: Ah, if I open State variables & functions for moveto floor I get nothing.
[18:03] Antonius: Open up the state variable editor for the top state
[18:03] Antonius: FloorHeights is a list of floats that corresponds one-to-one to FloorNames.
[18:03] Chef Pilot: yep, gottem now.
[18:03] Antonius: (I could have used a strided list for this, but I wanted to keep things simple.)
[18:04] Chef Pilot: Kiss principle
[18:05] Antonius: Yes, especially for an introductory model. So you can see we have four floors plus the ground floor.
[18:05] Antonius: We also have to put in "Reset" there, though the model could be changed to avoid having to do this and reset the script through some other means.
[18:06] Chef Pilot: Don't they call the ground floor - first floor?
[18:06] Antonius: It's most always called Ground, but you're right, then the next floor above should have been called Second.
[18:07] Antonius: The floor heights are each specfied as the distance from the ground floor along the z-axis.
[18:07] Chef Pilot: yep
[18:08] Antonius: The other variables are just housekeeping and don't need to be configured. Although you can set the Speed of the movement to the new floor if desired.
[18:09] Antonius: Let's take a look at the functions defined there.
[18:09] Antonius: Init() is called in the Initial Transition as we discussed earlier.
[18:10] Antonius: It starts by using a MOAB LSL Action to level the platform.
[18:11] Antonius: It then saves the current position in GroundFloor and assigns the name for the Ground Floor to Floor which is used to set a display title for the elevator (showing the current floor).
[18:11] Antonius: The movement of the platform is then constrained (straight from your script Pilot)
[18:09] Chef Pilot: Global variables?
[18:13] Chef Pilot: Although the variables FloorNames etc are entered in the highest state area, they would be considered globals ? They can be accessed by lower states?
[18:13] Antonius: Yes.
[18:13] Chef Pilot: This is where I was coming unstuck.
[18:14] Chef Pilot: Between global and state variables.
[18:14] Antonius: At the highest level, the state variables & functions operate exactly like LSL globals; they are accessible to all.
[18:14] Antonius: When you define a state variable/function for a particular state, it is only accessible to that state and any contained states that it may have.
[18:15] Chef Pilot: nods
[18:15] Antonius: We then ensure that MoveToTarget & physics are turned off
[18:16] Antonius: Next we look at the MoveTo() function (http://screencast.com/t/sJY0xQHH)
[18:17] Antonius: This function moves the platform to the new floor. It first calls the MoveToTarget() function and then turns physics on for the prim.
[18:18] Chef Pilot: Shouldn't the physics be changed before the move?
[18:19] Antonius: This ensures that the movement starts off correctly as there can be a delay before the MoveToTarget takes effect, so if we turn physics on first, we could get some drifting.
[18:19] Antonius: This trick came from the wiki.
[18:19] Chef Pilot: But the prim will leave anyone standing on it.
[18:20] Chef Pilot: Won't it?
[18:20] Antonius: You need to have physics turned on for MoveToTarget() to work. So it remains pending after calling it until physics has been turned on; that's the trick.
[18:22] Antonius: Is that ok?
[18:24] Chef Pilot: Oooohhhhhhhh....
[18:24] Antonius: It does work. I'll show you shortly.
[18:25] Chef Pilot: She's jake mate....
[18:25] Antonius: StopMove() stops the move and turns off physics. (http://screencast.com/t/Sg9PdGfT)
[18:26] Chef Pilot: No question about that, lol.
[18:26] Antonius: Ok let's take a look at the code within the MoveToFloor state (http://screencast.com/t/mEf1fcmZ)
[18:27] Antonius: On entering the state we have to get the floor position to move to.
[18:27] Antonius: So we first search the FloorNames list find the index of the floor name selected in the menu.
[18:28] Antonius: Then we index into the FloorHeights list to get the new z-axis value.
[18:28] Antonius: We add this to EndPosition which was initialized to the GroundFloor height.
[18:29] Antonius: We then simply call the MoveTo() function with this new EndPosition as a parm.
[18:29] Antonius: Any questions on this?
[18:29] Chef Pilot: It is easier when you explain it, lol.
[18:30] Chef Pilot: I got lost at floorindex
[18:30] Antonius: ok now?
[18:30] Chef Pilot: Yeah mate
[18:30] Antonius: Great!
[18:31] Antonius: I then added to your script the use of llTarget(),
[18:31] Antonius: which you can use to find out when you get close to the target specified in llMoveToTarget()
[18:31] Chef Pilot: Mate you added a sh*load the the initial script, lol.
[18:32] Chef Pilot: And the original script was in the free script library, lol, it wasn't mine :)
[18:32] Antonius: Well it inspired me anyways!
[18:33] Antonius: I also put in the timer as you had in case things go wrong.
[18:33] Chef Pilot: Yep. can see that.
[18:34] Antonius: Note that in the Exit Code for the state, we remove the target tracking, move the platform directly to the exact required position, and then stop the timer.
[18:35] Chef Pilot: yep
[18:35] Antonius: So going back to the top state, (http://screencast.com/t/WQ87qVKDrT2) you can see the at_target transition leaving the MoveToFloor state.
[18:36] Chef Pilot: It is unbelievable mate.
[18:36] Antonius: When the platform gets close to the destination (I set it to 0.1 meter), the at_target event gets sent.
[18:37] Antonius: The Exit Action code of MoveToFloor gets executed, we lock into the right floor position and then we move back to the WaitForCall state.
[18:38] Chef Pilot: tnum.....
[18:38] Chef Pilot: I gotta find tnum....
[18:39] Antonius: tnum is the argument name for the llTarget() handle
[18:39] Antonius: The handle was saved in TargetHandle in the Entry Action code of the MoveToFloor state.
[18:40] Antonius: So for completness we verify in the at_target transition that we are responding to the right llTarget() request.
[18:41] Antonius: We put that test in the Guard Condition of the at_target transition.
[18:41] Antonius: That's all there is to it.
[18:45] Antonius: Meet me outside. Let's try it out.
[18:46] Chef Pilot: We're here....
[18:46] Antonius: Here's the elevator. Try it out.
[18:47] Chef Pilot: Good stuff!
[18:48] Antonius: I really like it. It accelerates/decelerates nicely.
[18:48] Chef Pilot: Yeah!! Is really good!! Well done!
[18:47] Chef Pilot: What about weight?
[18:48] Antonius: Yes. I haven't tested all of that out yet, so there could still be some gotchya's.
[18:50] Antonius: A little bouncy. lol
[18:51] Chef Pilot: I'm smooth, but I'm using an ao.
[19:06] Chef Pilot: Well I gotta go for tucker mate :)
[19:07] Antonius: Have a good one!