4. Nimin Overview - XaderaDiddle/Nimin GitHub Wiki
After all is said and done about syntax and logic, Nimin itself is built in specific ways that might be helpful to understand.
The layout
Nimin is made up of 3 key pieces on the actual UI that goes into an event.
They are:
- The main text window.
- The main 12 buttons.
- The "Next" button.
Beyond those, there are the side panels that display stats and options and stuff, but those aren't needed for building out events.
Main window
The main text window is where all the reading happens. That's where all the text will go. In order to display text out to the window, you simply use the following 2 commands:
textL("Putting text in here will wipe the current text in the window and start off fresh with the text here.");
textLP("Putting text in here will be added to what's currently said in the window. Keep in mind this is being directly added on to whatever is there, so you'll need to consider putting an extra space at the front or a line break! Otherwise it will look bad.");
Remember, utilizing the String logic from the syntax and logic coding pages will be extremely useful in using those commands.
Main 12 buttons
The main 12 buttons are what the player clicks on to progress the game. These buttons are dynamic - they change based on what options you want to give to the player.
The buttons themselves are made up of 2 things. Their outlines and their texts. If you've played the game (which you should have if you're reading this), you'll notice that sometimes the outline is available, but there is no text written. That is intentional. An outline without text is used in the game to indicate that there's other options the player can potentially get, but they currently don't me the prerequisites to do that action (they're missing an item or a certain set of genitalia, etc.). This feature allows hints that there's more the player can do, which entices them to figure it out, like a small puzzle.
As such, when building an event, you need to specify which button outlines are visible, which button texts are always visible, and what the button texts say. And then you need to make the text visible for options only if the player's meet the requirements.
All of the above is done with the following commands:
- viewButtonOutline(0,1,1,0,0,0,0,0,0,0,0,1);
-
- There are 12 numbers in there, one for each button. The buttons are 1-4 in the top row, 5-8 in the middle row, and 9-12 in the bottom row. A 0 means the button outline is hidden. A 1 means it is visible.
- viewButtonText(0,0,0,0,0,0,0,0,0,0,0,1);
-
- Just as above, but for the text of the buttons. These are 2 different functions because you might want the text to be hidden for some. I might change this in the near future as I now realize the redundancy problem here...
- buttonWrite(X,"Some Text");
-
- This will write "Some Text" on button X. The text length should be 10 characters or less (I need to make this validation a thing...).
- ChoiceX.visible = true/false;
-
- For each button, you can make the text visible/hidden by setting this to true/false. Again, I realize I should probably change this...
A good example of this in action is here:
https://github.com/XaderaDiddle/Nimin/blob/master/Nimin%20v1/code/Events/Den.as#L24-L37
We set specific buttons and their text to visible, specifying buttons that would make a nice pattern. Then, we write the text to the buttons indication various options, mainly items they can choose from. Then there's some text to the window so the player knows what's going on. Then we remove the text from some of the options if the player already has that item (and thus cannot get another).
This will likely be rewritten in the future to make it easier for everybody.
"Next" button
What about the times where there are no options left for the player and you simply need to let the player "turn the page"? That's the next button. It's all nicely condensed into this little piece of code.
doNext();
Adding this will make all the main buttons hidden and make the Next button visible, while also setting up the clicking of the button to go to the next "scene". This will be more obvious with the next part.
Event "descending"
Nimin is built out fairly uniquely in terms of how events "progress". In other programs, you'll see scenes being called individually, and those scenes are somewhere else in the code. For me, that makes it difficult to visually grasp scenes that are tied to the same event, and keeping track of all the scene ids is annoying. So, Nimin does something special.
Nimin has an "anonymous" function called doListen(). doListen() does not do anything naturally, except listen to button clicks. When one of the main 12 buttons or the Next button is clicked, doListen() is called. From there, you have to specify what doListen() does. In most cases, doListen() will do different things based on what button is clicked. Ie, doListen() specify what the next scene will entail. And those scenes may specify doListen() to point to other scenes. And thus we have a sort of "descending" layout in Nimin. For every choice in an event, doListen() goes "one level deeper".
The following is a good example. It is primarily just a reading scene, so the only options are Next, which means doListen() will only do one thing (the "Next" scene).
https://github.com/XaderaDiddle/Nimin/blob/master/Nimin%20v1/code/Events/Den.as#L103-L154
You can see how each scene is visually "deeper" as the tabs go further right. It makes it much easier (for me at least) to see what level a scene is in an event.
Each level can also be indicative of paths based on button choices, where the buttonChoice (the button clicked when doListen is called) directs the rest of the path:
https://github.com/XaderaDiddle/Nimin/blob/master/Nimin%20v1/code/Events/Den.as#L155-L284
Event ending
In addition to telling a story, an event does a number of other things, such as granting items, SexP, impregnating, etc. This can happen through an event (like impregnating will occur during the cumshot scene), but a lot of the logic is saved for where an event "ends" - where the event is finished and the player goes back to town.
At the end of the event is generally where additional SexP is added, where the number of hours is specified (though it can be additive through an event), any items are added, and general stats are adjusted.
https://github.com/XaderaDiddle/Nimin/blob/master/Nimin%20v1/code/Events/Den.as#L144-L150
And very last, but not least, is doEnd(); . doEnd() contains doNext(), so it will automatically trigger the Next button and remove all other buttons (this is the end of the event, the player can't select any more paths, we're wrapping it up). It also contains all of the information for progressing the time, doing transformations, updating status-effects. It's essentially a "cleanup" step that does all the calculations, and then plops the player back in town.