XSimplePanel for Max

From OpenUru
Jump to: navigation, search

If you've explored my Age Neolbah, you've most likely come across my keypad that opens up the door leading to the elevator. If not, then you should have come across something like it called the Kadish Vault Control Panel, where you punch in the correct "code" to have the vault doors open.

Both are controlled with Python files. The button animations, glowing symbols, sound effects, yes, that is all done with Plasma components you put in Max. However, knowing what buttons the player has pushed, and if they are in the correct order, what to do if they are, and what to do if they are not, is all controlled by Python. The python files used in Neolbah and Kadish are custom made. Cyan made the one for Kadish of course, and Neolbah's was made for me by D'Lanor. You could technically pull either python file and use it, but you would have to edit it so that it would work with your Age and your puzzle.

But there is no need to go through all that as D'Lanor has made a special "Global" python file that you can use instead. It will not require you to edit it at all.

You can use it however, doing so there are some "rules" to observer:

  • Your puzzle can have up to nine "buttons" (or whatever you are using) or less. But it can NOT handle more than nine.
  • Players must click on the "buttons" in the correct order (so if the solution is 13579, they must enter that, not 39175 or anything else).
  • All the "buttons" must be pressed before the solution is checked. You could throw in some "fake" "buttons", but all "buttons" involved with this python file must be pressed by the player.

What You'll Need

What you are going to need is, the xSimplePanel python file. You can get it from the latest version of the OfflineKI downloaded from Drizzle. It will be in the GlobalAddon.pak file. Or if for some reason you are not using the OfflineKI, you can download it from Here.

Please note: D'Lanor has asked that you do not include these files with your Age's python .pak file, nor distribute these files, as any updates he makes to them could cause a conflict.

Once you have the files, you will need to place a compiled and uncompiled ( .py and .pyc) copies of it in your export folder that has all the python files you use for Max.

Once that is done, you can start Max and use it.

Using xSimplePanel

You will of course need to set up your puzzle involving your "Buttons", get it all textured and animated, and set up the responders for each button, a responder for a correct answer and of course a responder for the wrong answer.

Setting that all up is beyond the scope of this tutorial (and would keep me from my dinner!).

However, I DO need to show you that, all the responders that you set up for your "Buttons", you need to look at this:


That's right! There is NO activator in the detector box. Do NOT put one there! The python file will be controlling those responders.

Now you need to select an object (I think I used my keypad's frame), and open up your Component Manager. Click on New > Logic > Python File and assign it.

Then in the roll out for it, click on the dropdown box and find and select xSimplePanel:


(Please IGNORE the fact that in the picture above you see a different python name!)

If you look at the picture above, you will see a bunch of buttons. All the ones that are labeled "Act: Button 1, Act: Button 2, etc" click and pick the clickable for your button (if you don't have 9 of them, just leave the ones you don't have alone).

On the buttons that says "Resp Button 1 Down, Resp Button 2 Down, etc" click on each of them and pick the responder you made for that button (again, if you have less than 9 buttons, just leave the ones you don't have alone).

Now look at this picture:


You'll see a button for: "Resp All Buttons Up", this is where you put your responder that basically "resets" all your buttons.

Then, in the text box that says "Solution Sequence", you need to put in what your solution is, based upon the order of your Buttons. I don't CARE if your "buttons" are actually frogs that say "Croak!" when you click on them. I don't CARE if they are actually simply different colored thingys! The "Solution Sequence" is the order of what was pushed first, then 2nd, then 3rd, etc. So if you have 5 "buttons" and they are: Green, Red, Blue, Yellow, Cyan, the solution will depend on how you listed them in the Act: Button 1, Act: Button 2, etc above!

So if the color sequence I just listed is the order you used to pick Act: Button 1, etc, then you would have:

Green = 1
Red = 2
Blue = 3
Yellow = 4
Cyan = 5

And if your solution sequence is: Blue, Green, Cyan, Red, Yellow, then you need to put THIS in the "Solution Sequence" text box:


Understand? If not, get a hold of me over at the GoMa forum and I'll try to help explain it better (but don't get me started on Frogs......Big Frog, Little Frog, Fat Frog.....).

The next 2 text boxes are used for what ever SDL states you've set up in your SDL file. Here is how mine are set up:


    VERSION 5 # New Elevator Mechanics
# Elevator Door Puzzle

    VAR INT    neolButtonsPushed[1] DEFAULT=0
    VAR BOOL    neolDoorUnlocked[1]    DEFAULT=0

As you can see, the SDL varible for "neolButtonsPushed" is a INT, and this is what keeps track of what button the player has pushed.

The 2nd SDL varible, "neolDoorUnlocked" will set if the player has solved the puzzle.

If you want the player to have to do the puzzle over again, even if they solved it (like Neolbah, the keypad is to open the door, so you have to enter the code in every time you want to use the door), then put a check mark where it says "Replay if solved?"

Where you see "Click time-out" will be defaulted to 1 second. This is if you have more than one sound emitter that plays for you Buttons, to make sure they get done playing their sound before the player can click on another button. You can play with this if you need to.

You can leave the check mark off of "Init SDL on first update" alone, unless your puzzle is "paged" in later (like this is not a full Age, but you are using this in Pahts with a Shell).

Now, last thing. You will need to add another Python File component to an object, and select Cyan's Global python called "xAgeSDLBoolResp":


That's pretty much it!

Return To: 3DS Max Plugin Tutorials

Copyright (C) 2011 Andy Legate.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU Free Documentation License".