Fandom

NetStorm Wiki

$OnExit

167pages on
this wiki
Add New Page
Talk0 Share

Editing and making your own campaigns Getting Started,
Advanced Editing 1.Images | 2.Links and E-mails | 3.More [Options] Sections. 4.Options | 5.More [Header] Variables Header Variables | 6.Changing Text Colors | 7.Sacrificing for Knowledge | 8.Branching using MissionBegin | 9.Using denySalvage | 10.Outposts in Your Campaign | 11.Branching with MissionFork | 12.The Tell Command | 13.Creating Menus with $Menu | 14.Formatting Text and Graphics | 15.The $Timeout event | 16.The $OnExit event | 17.adding a DEMO to your Campaign | 18.Re-positioning the Text Window (with $MoveDialog)| 19.Timing with [@ ] | 20.Using the Debug Hotkey | 21.Moving the screen window with $View| 22.Variable basics | 23.IF/THEN Conditionals | 24.The $PlaySound command | 25.Netstorm Command List

view this alone

The $OnExit Event


Exiting, stage left

priestrun1.jpg

This event appears to be pretty basic. So what does $OnExit do? Well, just like its name suggests, this will cause something to happen once a $Button event or a $Menu event has been called.

The syntax for $OnExit is very much like the syntax for many of the other Netstorm events ($Button, $Menu):

$OnExit=description,command,command extension

The description is what the player will see inside a button. Note: description is optional. If you don't use it, you still have to have a comma before the command. You should know the Netstorm  commands by heart by now: either MissionBegin, MissionFork, MissionAbort, MissionRestart, MissionReview, MissionEnd, Tell, GetTechnology or ShowTechnology. Command extension has to do with the command that you use. Refer to the advanced editing section to see what these commands need for their extensions.

An example:

Let's try an example. Say in your campaign you want the player to have a choice: either he allies with Mr Evil, or he fights against him. In either case, you want the storyline to branch to a section called [continue]. One way of doing this would be to use the $OnExit command as follows:

[Options]
[A.]

Mr Evil, your sworn arch enemy for years, asks for an alliance. Do you agree?<br>

$Button=YES,DoNothing,0
$Button=No,DoNothing,0
$OnExit= ,Tell,continue

[continue]
<h2>Treachery!</h2>
<p>While you were deciding whether or not you wanted to ally with Mr. Evil, he has brazenly attacked your island!

$Button=To Battle,DoNothing,0

So, no matter what is chosen, when a button is clicked on either YES or NO, the game will branch to the [continue] routine. Also, check out the $OnExit line. See the first comma? Make sure there's a space between the equals sign and the comma, or else the command won't work.

Another example:

Wait a second, swelb. Can I have a menu, and then after the player picks something from it, use the $OnExit command to continue with the story? Of course you can. Here's how you'd do it:

[Options]
[A.]

Breaking into the enemy's encampment at night, you find plans for new weapons. You only have time to take one plan. Which will it be?<br>

$Menu=~[IrainCannon.3]rain cannon,GetTechnology,129
$Menu=~[IsunCannon.3]sun cannon,GetTechnology,128
$OnExit= ,Tell,gotweapon

[gotweapon]

A good choice! However, you've awakened the enemy! Prepare for battle!

$Button=OK,DoNothing,0

There's one problem with using $OnExit. And that has to do with the above example. When you run the code and the player picks the weapon, the GetTechnology screen is shown, then immediately the program branches to [gotweapon], and that screen is shown on top of the GetTechnology screen. Here's what you'll see before you select your Tech:

File:OnExitex1.jpg

So far so good, but what happens when you select what weapon you want? Well, in theory, you should get the standard Technology Gained screen, then another screen that tells you that what you selected was a good choice. Well, you do get those things, but....

File:OnExitex2.jpg

see the problem? The Good Choice window draws over the Tech Gained window, which isn't really quite what we want. It would be nice to have the Good Choice window behind the other window.

So, howdoyadothat, you say? I dunno. Haven't figured it out, yet. But we'll keep at it.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.