Mecha Construction in SL, Lesson 2

[16:49]  Jurgi Harlan: I have a copy of that tank behind you.
[16:49]  You: How do you like it?
[16:49]  Jurgi Harlan: I found it got stuck on walls very easily.
[16:49]  RacerX Gullwing is offline
[16:50]  Jurgi Harlan: Not as in wedged, so much as it drove up them and ended up balanced on it’s rear.
[16:50]  You: Sad! I had been working to make it as robust as possible. Oh wel..
[16:50]  Jurgi Harlan: Perhaps some manner of command to cause it to right itself when upended?
[16:51]  Kage Seraph ponders that. Yes, that’s easily doable.
[16:51]  You: Would you like to work on mecha a bit this evening?
[16:51]  Jurgi Harlan: perhaps keyed to a voice command.
[16:52]  Jurgi Harlan: Indeed I would, Kage. That is why I have come, to continue my lesson.
[16:52]  Jurgi Harlan: And to report what I have learned in study so far.
[16:52]  Dizzy Arnaz shouts: DADDDDDDDDDDDY
[16:52]  You: Please do; you had mentioned earlier that you know now how to do rotating gears and things?
[16:53]  Jurgi Harlan: Yes…I believe the code was TargetOmega or somesuch.
[16:53]  Jurgi Harlan: Let me consult my notes.
[16:55]  Jurgi Harlan: Alright…paper is unreliable.
[16:55]  Jurgi Harlan: I will henceforth keep my notes on virtual notecards.
[16:56]  Jurgi Harlan: But yes, I managed to take apart the gear and antenna, and do some study on the command.
[16:56]  Kage Seraph smiles. I have the LSL wiki on speed dial. It saves mucho mucho time.
[16:56]  Jurgi Harlan: Indeed, I have it on my desktop now
[16:57]  Jurgi Harlan: I also noted that with the command, your attachment stays fixed, it is a illusionary rotation.
[16:57]  You: What would you like to cover tonight? We’d discussed the underlying principles pretty fully last time we met. Perhaps a more hands-on experience tonight?
[16:58]  You: Yes, llTargetOmega is a wholly clientside phenomenon. Thus, though we both see rotation with it, the given angle at any moment may be different for each of us.
[16:58]  Jurgi Harlan: Well, we had grasped the mechanics of the prims side of the issue.
[16:58]  Jurgi Harlan: Can we talk about appearing and disappearing parts, like in the Aereopteryx?
[16:59]  You: Certainly!
[16:59]  You: Two functions are useful in this context, llSetAlpha and llSetLinkAlpha.
[17:00]  Jurgi Harlan: Alpha…so is this related to the alpha channel?
[17:01]  You: Yes indeed. Both functions take a proportion (0-1) of alpha/transparency, as well as a side of the prim that the operation will take place on.
[17:01]  Jurgi Harlan: Proportion…related to a percentage?
[17:02]  Wayfinder Wishbringer is offline
[17:02]  You: A proportion is a fraction expressed as a decimal between 0 and 1 inclusive, so 50% is the same as 0.5 (proportion)
[17:02]  Jurgi Harlan: /nod
[17:03]  Jurgi Harlan: I thought as much, please continue.
[17:03]  You: The LSL wiki also refers to proportions as sliders occasionally. Same thing.
[17:03]  Jurgi Harlan: Alright
[17:03]  Wayfinder Wishbringer is online
[17:04]  You: So, to set the first face of the prim I’m setting on to transparent, the function call looks like: llSetAlpha( 0, 0 );
[17:04]  You: To set it to opaque: llSetAlpha ( 1, 0 );
[17:04]  Jurgi Harlan: Alright, so the number measures opacity.
[17:04]  Jurgi Harlan: As opposed to transparency.
[17:05]  Ben Kerensky is online
[17:05]  You: You can also specify that the whole prim is affected: llSetAlpha( x, ALL_SIDES);
[17:05]  Jurgi Harlan: Good, that will speed things up, I suspect.
[17:05]  You: SetLinkAlpha is the same in all respects except that you also specify the linknumber of the prim you want to operate on.
[17:06]  You: So with a little extra work, one code block in one script can render an entire complex object trasparent, opaque, or somewhere in between.
[17:06]  Jurgi Harlan: There we go.
[17:06]  Jurgi Harlan: Let me try that.
[17:06]  You: But that requires a for loop.
[17:06]  Jurgi Harlan: Oh, wait, dinner, give me a moment
[17:08]  Jurgi Harlan: There we go
[17:09]  Cabbit Grasshopper is online
[17:09]  Jurgi Harlan: One complex object, like…a plane mode?
[17:10]  You: All that said, a central control script detects if the agent is flying or not, and if the results of that check are different than the last time, then the controller tells subscripts to toggle transparency in each prim
[17:10]  Jurgi Harlan: Alright, what’s the command to detect flying?
[17:10]  You: Alternately, the control script could do the toggling itself using SetLinkAlpha, though this approach is substantially slower
[17:11]  You: integer llGetAgentInfo(key id)
[17:11]  Jurgi Harlan: So, you could set the transform sequence to anything, voice commands, HUD buttons, flying state.
[17:12]  You: So for flying, that would look something like: if( llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
[17:12]  You: yes, that is correct.
[17:13]  You: If it is slaved to a HUD command, you could add in some pretty terrific blastoff / transform / etc. effects.
[17:13]  Jurgi Harlan: What would be the downside of a HUD control system?
[17:13]  Dirty McLean is offline
[17:13]  You: having to code secure communications between the HUD object and the transforming object.
[17:14]  Jurgi Harlan: Okay.
[17:14]  You: The central issue is that SL doesn’t currently support direct object-2-object communication, so you have to do it through chat (error-prone and slow)
[17:14]  Jurgi Harlan: Yes, I’ve seen that with Blitzwing.
[17:14]  Forseti Svarog is online
[17:15]  Jurgi Harlan: While the size was not in good order, it has a lot of functions for me to master.
[17:15]  Second Life: Your vote was received.
[17:15]  You: Good! Don’t be afraid to pull it apart into simpler dissections; this cube I’m sitting on is a simplification of the cloaking system I’m building into that vehicle you saw.
[17:16]  Jurgi Harlan: Alright, can I show you some of the things I wanted to discuss on it with you?
[17:16]  You: Sure!
[17:17]  Jurgi Harlan: Alright, you’ve explained to me about the appearing and disappearing sections…
[17:17]  Object: Hello, Avatar!
[17:17]  Jurgi Harlan: We spoke in our first lesson of the natural limits of movement for a avatar’s joints.
[17:19]  Jurgi Harlan: Okay, is this a violation of those joint laws?
[17:19]  You: Not at all. You’re observing that the rotation on the feet, for example, is impossible for a real human?
[17:20]  Jurgi Harlan: Indeed
[17:20]  SirCori Everidge shouts: LOL!!!!!!!!!!!!!!!!!!!!!!!
[17:21]  You: Any joint we have access to can be rotated in any direction for thousands of degrees if need be. The issue with larger mecha is that the /joining/ of the bones to make joints cannot be violated.
[17:21]  Jurgi Harlan: Ah!
[17:21]  You: That is, my femur must always remain attached to the pelvis, regardless of the rotation of that ball and joint socket, I can never dislocate it.
[17:21]  Jurgi Harlan: What of this flipping my head upside down?
[17:21]  You: Excellent question.
[17:22]  Lydie LeMay: hey guys
[17:22]  Jurgi Harlan: Hello, Lydie.
[17:22]  You: The rotation is anything you set it to be, even outside the limits of human ability, but the ends of the bones must forever be attached to one another.
[17:22]  You: Hi, Lydie!
[17:23]  You: So, you can fold the head down into the chest, but you can’t pull it off the neck in any way.
[17:23]  Object: <0.00000, 0.00000, 0.00000, 1.00000>
[17:23]  Object: 0.785422
[17:23]  Object: <0.00000, 0.00000, 0.00000, 1.00000>
[17:23]  Object: 0.785422
[17:23]  Object: <0.00000, 0.00000, 0.00000, 1.00000>
[17:23]  Object: 0.785422
[17:23]  Object: <0.00000, 0.00000, 0.00000, 1.00000>
[17:23]  Object: 0.785422
[17:23]  Object: <0.00000, 0.00000, 0.00000, 1.00000>
[17:23]  Object: 0.785422
[17:23]  Object: <0.00000, 0.00000, 0.00000, 1.00000>
[17:23]  Object: 0.785422
[17:23]  Jurgi Harlan: I see.
[17:24]  You: Believe me, that restriction drives me crazy. Ha!
[17:24]  You: Oh well.
[17:24]  Jurgi Harlan: I’ve figured out sitting to some extent, by the way.
[17:25]  You: Sitting well is about the only thing that separates the oldbies from the newbies, in the end. 😉
[17:25]  Jurgi Harlan: Tertiarily, I wondered as to the viability of onboard weaponry.
[17:25]  Wisteria Frye shouts: but u are
[17:26]  Wisteria Frye shouts: dont put the hat on shaka gives you, its a penis
[17:26]  You: It is 100% viable. Sensor-based, prim-based, both, anything is fair game.
[17:26]  Kado Okame shouts: Hes reported now anyways
[17:26]  Wisteria Frye shouts: bwaaaauuuhhh
[17:26]  Jurgi Harlan: Okay, do you have any lessons you can teach me on weapon systems, both how to design them, and counteract them?
[17:27]  Jessica Qin is offline
[17:27]  You: I can certainly guide you in building them, but counteracting them is difficult, especially if you’re including counteracting weapons not designed by you.
[17:28]  You: Perhaps the best way to tackle weapon design would be through a basic example.
[17:28]  Jurgi Harlan: Alright.
[17:28]  You: What shall we make? A rocket? Gun? Minelayer?
[17:28]  Jurgi Harlan: How about a cannon for this avatar?
[17:28]  Jurgi Harlan: Something to match up to the tank turret.
[17:29]  You: As you wish.
[17:29]  Blitz-flyer v1.5 whispers: Type help for help.
[17:29]  You: The first task is to create the munition.
[17:29]  Jurgi Harlan: Alright.
[17:30]  You: For the scripting involved, the wiki’s example is most elegantly done.
[17:30]  You: it handles setting the damage level, and what the munition should do when it strikes (1)ground (2) an av and (3) a prim
[17:31]  Jurgi Harlan: Hm.
[17:31]  Jurgi Harlan: What about an avatar’s attached prims?
[17:31]  Jurgi Harlan: Like these wing assemblies? Or a mech?
[17:31]  You: As a realistic munition would react differently to each of these collisions, it is good to see each case handled separately.
[17:32]  You: The munition will only collision-detect on the av’s collision skeleton, which if I recall correctly is located at the agent’s position between the legs of giant mecha. For your current av, the size difference is vanishingly small in a firefight.
[17:33]  Jurgi Harlan: I see.
[17:33]  Jurgi Harlan: /nod
[17:33]  You: That is, I could shoot through your wingtip but still miss you completely.
[17:33]  Jurgi Harlan: But that’s a small margin of error compared to having to shoot the Aereopteryx in the crotch
[17:33]  You: The collision skeleton is simply a LL hack to simplify the number of prims for Havok to deal with in physics calculations.
[17:34]  You: Yes, exactly re: Archaeopteryx
[17:34]  Jurgi Harlan: Ah, and I’ve been using the dinosaur name…I feel a fool now.
[17:34]  Kage Seraph smiles again. That’s no problem!
[17:35]  You: In any case, let’s briefly walk through the contents of the bullet script in the wiki so we both know what we’re doing.
[17:35]  Jurgi Harlan: Alright, let me bring it up.
[17:35]  You:
[17:35]  You: second script there
[17:36]  Jurgi Harlan: By the way, I assume that the collision box is related to the agent?
[17:36]  JetBall Doorway – Black Team shouts: Black Team New Player!
[17:37]  You: Yes, that is the case.
[17:37]  Jurgi Harlan: I thought as much, as it is what we bump into things with, and alot of these gun designs mention push.
[17:38]  Wayfinder Wishbringer is offline
[17:38]  You: Yes, push is a much-abused design feature we should discuss eventually. Ha. So, in state_entry, what are we doing with the bullet?
[17:39]  Jurgi Harlan: Okay, the first command seems to indicate the object is summoned, rather than permanent.
[17:40]  You: Correct, temp_on_rez gives the bullet a limited lifespan in case it gets lost. Good! Continue!
[17:40]  Jurgi Harlan: Alright, give me a second…
[17:40]  You: (also, note that temp_on_rez still deletes the bullet after ~1 minute even in no-script areas where llDie would silently fail)
[17:42]  Jurgi Harlan: Alright.
[17:43]  Jurgi Harlan: Status Physics seems to indicate that the bullet will react to gravity, simulated air friction, etc, like a flexible prim.
[17:43]  Jurgi Harlan: Die_at_edge seems to lead me to believe that sim zonelines will destroy the projectile as well.
[17:45]  You: Yes, enabling physics allows the physics engine (and clientside guessing/smoothing) to move the bullet gracefully through the air, in contast to the jerky motion we’d get using nonphysical movement.
[17:45]  Jurgi Harlan: Alright…
[17:45]  Jurgi Harlan: And Die_at_edge?
[17:46]  You: Die_at_edge deletes the prim if it hits the edge of the continent, *instead of returning it to your inventory*. An important detail for automatic weapons.
[17:46]  Jurgi Harlan: Ah, so at the edge of the continent.
[17:46]  Jurgi Harlan: Is there an inherent property that would do so if it crossed onto another server?
[17:47]  You: Next, I’ll take us through on_rez, since you’ve likely not seen many of those functions yet.
[17:47]  Jurgi Harlan: I note the TimetoDie hack of it above there.
[17:47]  You: Not a native function, though you could have the bullet record its present sim at each time slice, then compare for any differences and die if so.
[17:47]  Jurgi Harlan: Ah, so it would take a loop.
[17:47]  Jurgi Harlan: Please, proceed.
[17:48]  You: start_param in an integer that is passed from the script rezzing this munition to the scripts in the bullet.
[17:48]  Jurgi Harlan: Alright.
[17:49]  Jurgi Harlan: I see what you meant by elegant code, it’s almost English.
[17:49]  You: So, you can use that to see if the bullet is rezzed directly from inventory, or from the gun. Useful for debugging (e.g., you can turn OFF the auto-die functions if you’re rezzing the bullet from inventory to modify it).
[17:50]  Jurgi Harlan: Yes, by //-ing it out?
[17:50]  You: The first line within says “if the start_param equals zero (or false), then we must have rezzed from inventory and therefore, exit this code block before setting the collision filter, etc.”
[17:51]  Jurgi Harlan: Alright. So only if code summons it will the branch operate…in theory.
[17:51]  You: yes, you can comment out code with “//” on a line by line basis, but scripts cannot comment themselves. Rather, you can program in returns like we see here to do essentially the same thing.
[17:51]  You: Yes, that is the case.
[17:52]  You: Next, the bullet is told to not pay attention to any collisions with its owner ( llCollisionFilter(“”, llGetOwner(), FALSE); )
[17:52]  Jurgi Harlan: /nod
[17:52]  Jurgi Harlan: So you can’t accidentally set it off as it leaves your agent-space.
[17:53]  You: Next, the damage parameter is set equal to whatever value the rezzing script passed in start_param, so users of this bullet can dynamically update how dangerous they want the bullet to be in combat sims.
[17:53]  Wayfinder Wishbringer is online
[17:53]  You: The next line is commented and pretty straightforward at that.
[17:53]  Jurgi Harlan: Okay, if I can interject?
[17:53]  You: Sure, Jurgi.
[17:54]  Jurgi Harlan: What degree of interaction with damage does SL inherently have?
[17:54]  Jurgi Harlan: And what is it really defined as?
[17:55]  You: Damage only applies in damage-enabled areas, of which there are relatively few. When your life, expressed as a percent, hits zero, you’re teleported “home”. That’s about the extent of damage handling in SL, aside from very basic regeneration between hi
[17:55]  You: *hits.
[17:55]  You: Thus, uost combat systems handle damage other ways.
[17:56]  Jurgi Harlan: So even outside of Darklife, or other RPGs, we actually possess HP?
[17:56]  nonnux White is online
[17:56]  Jurgi Harlan: Right now, sitting here, we have a damage pool that can be harmed?
[17:57]  You: No, not at this time because this parcel does not have damage enabled. Were that the case, you’d see a little red heart and the lofe percentage at the center top of your SL screen.
[17:57]  Jurgi Harlan: Alright.
[17:57]  You: visit Jessie or Rausch sometime and you’ll see quite readily.
[17:57]  Jurgi Harlan: I’ve never seen that, so I guess I’ve never been to a combat sim
[17:58]  Jurgi Harlan: But the damage system this bullet and gun interact with is a toggleable system inbedded in SL.
[17:58]  You: Yep!
[17:58]  Jurgi Harlan: Alright…go ahead.
[17:59]  You: Finally in on_rez, we set a timer to go off after the pecified interval. What’s the interval and what happens when it is up?
[18:00]  Jurgi Harlan: It’s defined before the constants, and has a value of 20.0
[18:00]  Wayfinder Wishbringer is offline
[18:01]  Jurgi Harlan: I interpret it to be that when the counter concludes, the bullet unsummons.
[18:01]  Jurgi Harlan: As for the interval, I do not know.
[18:01]  You: Twenty seconds, yes.
[18:01]  Jurgi Harlan: Ah, alright.
[18:01]  You: Correct on both counts.
[18:02]  You: Next, we have collision_start, which fires every time the bullet hits something. Sometimes it will fire multiple times for a single object if it hits it multiple times (e.g. on a ricochet).
[18:03]  Jurgi Harlan: Alright.
[18:03]  You: Within collision_start, we filter against whether or not the collision was with an av or anything other than an av (an by extension, land as well).
[18:03]  You: Where it says “// tricky stuff like proprietary damage goes here” you typically insert blood spatter particle code, successful hit sound code, etc.
[18:04]  Slade Onizuka is online
[18:04]  Jurgi Harlan: I see, your special effects and such.
[18:04]  You: Pretty much. Finally, the bullet also responds to striking bare ground, useful for sending up clod-of-mud particles and things like that.
[18:05]  Jurgi Harlan: Alright, I also notice the ||Die command there.
[18:05]  Jurgi Harlan: Does that auto-unsummon any object it’s imbedded in?
[18:05]  Jurgi Harlan: Or even destroy permanent prims?
[18:06]  You: Yes, as long as the event happens in script-enabled land. Otherwise it doesn’t fire and the bullet simply falls to the ground motionless.
[18:06]  You: Thus, recall we set temp_on_rez up there just in case that happens.
[18:06]  SamBivalent Spork is offline
[18:07]  Jurgi Harlan: Will ||Die work on a permanent prim, like a castle?
[18:07]  Jurgi Harlan: Or only on a summoned object?
[18:07]  You: If by permanent you mean non-physical, then yes. It will work on pretty much anything except attachments, I believe.
[18:08]  JetBall Doorway – Black Team shouts: Black Team New Player!
[18:08]  Jurgi Harlan: I mean non Temp_On_Rez
[18:08]  You: Yes, it will also work in that case.
[18:08]  Jurgi Harlan: Alrighty.
[18:08]  Jurgi Harlan: Please continue.
[18:09]  You: As a final note on that, be careful in triggering llDie; it is an easy way to lose the latest updates you’ve made to the script calling it. Haha! Let’s have brief remark on bullet design.
[18:09]  Jurgi Harlan: Alright.
[18:09]  JetBall Doorway – Black Team shouts: Black Team New Player!
[18:10]  JetBall Doorway – Black Team shouts: Black Team New Player!
[18:10]  You: The bigger the bullet, the bigger kinetic energy it has when rezzed at speed. The same KE is applied to the rezzing prim when it rezzes. Recall Newton’s Laws of Motion here.
[18:10]  Raiden Karuna is online
[18:11]  You: Thus, guns with large bullets push the wearer with a force that counteracts the rezzing force.
[18:11]  Jurgi Harlan: A more massive object moving at the same speed has more power than a lighter one.
[18:11]  LiquiDiamond Frost is offline
[18:11]  You: Yes, and every action has an equal and opposite reaction, so the gun ‘pushing’ the bullet forward also ‘pushes’ you backward.
[18:11]  Raistlin Otis is online
[18:12]  Jurgi Harlan: I see.
[18:12]  You: (Because you are physics-enabled).
[18:12]  Jurgi Harlan: But our collision detection is also off…
[18:12]  Memir Quinn is online
[18:12]  You: For small bullets, this force is insufficient to overcome your inertia so folks don’t worry about scripting around it.
[18:13]  Jurgi Harlan: And my tank mode being pushed back a little would be more realistic anyway…
[18:13]  You: True, collision detection is off, but the bullet generally only collides with the firer on a ricochet.
[18:13]  You: (most gun scripts rez the bullet perhaps a meter away from the firer).
[18:13]  Jurgi Harlan: I see, so our physics are still interacting, I’m just circumventing triggering impact code.
[18:13]  You: Yes, that is the case.
[18:13]  Jurgi Harlan: I see.
[18:14]  You: Let’s transition to the gun script. This one is a bit longer, but still well-factored and -written. Browse through it and let’s tackle any questions you have about it.
[18:15]  Jurgi Harlan: Alright.
[18:16]  Jurgi Harlan: First we have variables being defined…
[18:16]  Jurgi Harlan: Some of them being loaded already.
[18:16]  Ben Kerensky is offline
[18:16]  Paul Linden: Some Regions will be going offline in 15 minutes to resolve a stability issue.  Effected Regions should be up whithin 30 minutes.
[18:16]  Jurgi Harlan: I notice a branch being loaded with the Say(string message) thing there.
[18:17]  Jurgi Harlan: Let’s begin there/
[18:17]  You: Okay. the say( * ) function is a general-purpose user-defined global function, so it can be called from anywhere.
[18:18]  You: the branch that calls it supplies the string that becomes the message that is ownersaid.
[18:18]  Jurgi Harlan: Alright…I think I got that…in this case, what is the use of it?
[18:18]  Jurgi Harlan: Wait.
[18:19]  Jurgi Harlan: I think I get it.
[18:19]  Jurgi Harlan: It creates a “say” command to force the weilder to speak error codes and messages from the gun code, so he can get information from it.
[18:19]  Jurgi Harlan: Which are stored in the variable “message”
[18:20]  You: Yup! This is a function mainly used for debugging.
[18:20]  Jurgi Harlan: Alright!
[18:20]  Jurgi Harlan: I’m getting it…let’s keep going.
[18:20]  You: Press on forward, my good man!
[18:21]  Jurgi Harlan: Its then polling the wielder for permission to override his functions.
[18:21]  JetBall Doorway – Black Team shouts: Black Team New Player!
[18:21]  Cabbit Grasshopper is offline
[18:22]  Jurgi Harlan: To run animations, read his input, and stick to his hand.
[18:22]  You: Yes, the user must at least implicitly (by attaching it) grant the weapon permission to begin reacting to the user’s control inputs. In this case, the control input we want is the left mousebutton in mouselook, as we’ll soon see.
[18:22]  You: If the script was not required to gain permission, imagine the potential abuses…!
[18:22]  Jurgi Harlan: Could one map the gun trigger to another button?
[18:23]  You: Yes indeed.
[18:23]  Raistlin Otis is offline
[18:23]  You: to any of the movement keys or combinations thereof.
[18:23]  Jurgi Harlan: But not to, say, the letter F, or Number Lock?
[18:24]  You: Unfortunately no. We’ve been pleading for this since 2003. So far no good.
[18:24]  Jurgi Harlan: Alright, so movement keys and mouse buttons.
[18:24]  Jurgi Harlan: Managable.
[18:25]  Jurgi Harlan: Then it filechecks itself, making sure you also own the Bullet code and gunfire sound.
[18:25]  Jurgi Harlan: If not, it makes you tell yourself so.
[18:25]  Jurgi Harlan: A smart piece of code there.
[18:25]  Jurgi Harlan: Never would have thought of that back in college.
[18:25]  Chase Speculaas is offline
[18:26]  You: Yes, sort of. It’s checking to see if those items are in the gun objects inventory. If not, the gun cannot rez the bullet or trigger the sound as the case may be.
[18:26]  You: *object’s
[18:26]  You: The assumption is that if you don’t own it with sufficient rights, especially copy rights, you won’t usefully be able to put it into the gun’s inventory.
[18:27]  You: Next we have arm and disarm. Go on, you’re doing very well!
[18:27]  IM: The Sojourner: Please join us in a gathering/dance tomorrow night (Thurs) from 5-7:30 pm at Dreams.  It is casual (low prim) to say thank you ALL!
[18:28]  Raistlin Otis is online
[18:28]  Jurgi Harlan: Alright, it consults the permissions it’s been given, then hijacks your left mouse button, but only in mouselook, and runs the animation of you raising the gun into a ready position.
[18:29]  You: Perfect.
[18:29]  You: And if it doesn’t have the permissions, it tries to get them again, just in case.
[18:29]  Jurgi Harlan: Ah, I didn’t notice that.
[18:29]  Jurgi Harlan: Yes, I see it leaping back to that branch there.
[18:30]  Jurgi Harlan: Also, it toggles on the Armed variable.
[18:30]  Jurgi Harlan: What’s that do?
[18:31]  Jurgi Harlan: I’m sorry. Is my ADD acting up or do I hear GIR?
[18:31]  You: that surfaces again in the attach() branch.
[18:31]  Kage Seraph unmutes SL
[18:31]  You: A high-pitched voice?
[18:32]  Jurgi Harlan: yes, GIR, from Invader Zim.
[18:32]  You: Your ADD appears to remain under control. =D
[18:32]  Jurgi Harlan: Distracting.
[18:33]  You: Anyway, gArmed is used to indicate what the gun script should do when the gun is detached. If it was armed (gArmed = TRUE), then the disarm function is called.
[18:33]  Jurgi Harlan: Okay, anyway.
[18:33]  You: but we haven’t got there yet. Ha!
[18:33]  Jim Herbst is online
[18:34]  You: disarm simply tidies up permissions, releases controls, and lets the user have his or her av back in full functionality.
[18:35]  You: Let’s jump down to touch_start(integer count)
[18:35]  Jurgi Harlan: Okay.
[18:35]  You: hint: “!=” reads aloud, “does not equal”
[18:35]  Jurgi Harlan: I had interpreted that…
[18:36]  You: and llDetectedKey(0) supplies the key of whoever just touched the object (clicked on it, not collided)
[18:36]  Jurgi Harlan: Yes.
[18:36]  Jurgi Harlan: So it’s checking if the wielder is the owner there.
[18:37]  You: Yup! What else is happening there?
[18:37]  Jurgi Harlan: One second.
[18:37]  Jurgi Harlan shouts: Whoever has the GIR sounds, send them to me so I can mute this in peace? kthnx
[18:37]  Jurgi Harlan: Alright.
[18:37]  Chase Speculaas is online
[18:37]  Jurgi Harlan: I’m a Invader Zim fan.
[18:37]  Jurgi Harlan: Now then…
[18:38]  Jurgi Harlan: Else if Get attached…I am in the neighborhood, but I can’t find the exact meaning there.
[18:38]  Slade Onizuka is offline
[18:39]  You: else if I am not attached, then run the getperms branch, which does three things including attaching the gun to the avatar
[18:39]  Jurgi Harlan: Okay, so it checked to see if it’s already in hand.
[18:39]  You: Correct, go on.
[18:39]  Jurgi Harlan: If not, it asks for permissions.
[18:40]  You: (and when it gets them it attaches, yes)
[18:40]  Jurgi Harlan: Then…it checks to see if the Armed setting is on…
[18:41]  Avery Habsburg: rofl u can transform?
[18:41]  Jurgi Harlan: If so, it disarms, if not, it arms.
[18:41]  Jurgi Harlan: And yes, Avery, I can.
[18:41]  You: Right on target. Yes.
[18:41]  Jurgi Harlan: Are you the one with the GIR noises?
[18:41]  Avery Habsburg: can u show me?
[18:41]  Avery Habsburg: no?
[18:41]  Jurgi Harlan: One sec, Kage, let me get this out of the way.
[18:42]  Avery Habsburg: where did u get that?
[18:42]  Jurgi Harlan: Okay, my get mode is screwed up
[18:42]  Avery Habsburg: rofl lmao
[18:42]  Jurgi Harlan: yagni’s pyramid