Instalite's shield generator quest script [v. 0.2]

Instalite

New member
So as not to feel left out, I am also starting a thread for my script for slyz's contest.

The main selling point of this script is that I've tried to make it abort whenever it appears to be doing something braindead. For instance, the spooky little girl not coming up when expected may, I believe, happen if the adventure is lost to lag. The script will abort if she is not found after a magic number of adventures (to account for wandering monsters, which may override the adventure). The magic numbers can be adjusted in the script file, but the defaults should be appropriate under normal circumstances. I believe such cases require human intervention and thus aborting is the right thing to do.

The one point that doesn't have a hard cap on adventures spent is farming safety shelter maps. I consider it the user's responsibility to set up outfit, CCS and auto-restore settings to allow him to survive and get drops.

I may or may not add any features, since the script already does everything I personally need.

Feedback is appreciated, particularly if the script does something unexpected under certain circumstances.


Usage notes (also included in the .ash):

This script assumes you are equipped to handle combat on the moons with and without the spooky little girl equipped.

If the outfit "instagen-mapfarm" is defined (name configurable), the script will equip it to farm safety shelter maps. If it is not, the script will run the modifier maximizer instead. Buffs are not automatically cast.

For the escort mission part, the outfit equipped when you start the script will be used with the spooky little girl instead of your equipped offhand. Two-handed weapons will be unequipped. The E.M.U. unit will be equipped in accessory slot 3 when acquired.

Should the script be aborted during the quest, the CLI command "outfit checkpoint" will restore your original gear.

Available settings (at the top of the .ash file) are:
* TRANSPOND (default true). Set to false to disable buying (pending 'buy from mall' setting) and using transponders when needed. Idea to allow disabling copied from LotsOfPhil.
* ESCORT_ABORT (default 2). The script will abort if the spooky little girl runs away this number of times.
* UNOLFACT (default false). If set to true, the script will remove On the Trail during the map farming phase if the currently trailed monster doesn't appear in the current zone. This is meant to be used with a CCS that olfacts survivors. The script will abort if a SGEEA is not available and cannot be acquired.
* MAPFARM (default "instagen-mapfarm"). Name of the outfit the script should try to equip for farming safety shelter maps, enclosed in double quotes.


Changes:
v. 0.2.1
* Added MAPFARM as a setting.
* The message printed when uneffecting On the Trail is now in green to match other output.

v. 0.2
* Added UNOLFACT option to deal with the new monsters.
* Removed unnecessary line break characters.
 

Attachments

  • instalite-shieldgen-0.1.ash
    11.7 KB · Views: 91
  • instalite-shieldgen-0.2.ash
    13.1 KB · Views: 66
  • instalite-shieldgen-0.2.1.ash
    13.2 KB · Views: 72
Last edited:
Looks very good, insta. Easy to read/well-structured. Two first impressions:

1) Why is the string when looking to play porko called "ham"? :)
2) When you use the maps, you have a switch(). Shouldn't you have a default case?
 

Bale

Minion
The main selling point of this script is that I've tried to make it abort whenever it appears to be doing something braindead.

Catching errors is great. Personally I don't like abort(). It is best if you can find a graceful way of ending the script with the error message. That's just a minor style issue though.


1) Why is the string when looking to play porko called "ham"? :)

LoL! That's awesomely funny!

2) When you use the maps, you have a switch(). Shouldn't you have a default case?

Why should he? That's optional and the script wouldn't really benefit from it.

bail("No winning move in global thermonuclear porko.\n");

That never gets old. ;) Why the forced newline character on every abort and print?
 
Last edited:

fronobulax

Developer
Staff member
2) When you use the maps, you have a switch(). Shouldn't you have a default case?
Why should he? That's optional and the script wouldn't really benefit from it.


A common source of coding errors in other languages is to misuse and abuse the switch statement or equivalent. Including a default case (or explicit braces or breaks or similar optional constructs) usually makes the code easier for someone else to understand and debug or extend. I'd award style points to lotsofphil under these circumstances. ;)
 
Catching errors is great. Personally I don't like abort(). It is best if you can find a graceful way of ending the script with the error message. That's just a minor style issue though.

I had things with exit; but the documentation made me think abort(); was better. Something about clearing out queued commands. Is this not the case?
 

Alhifar

Member
If you are running a script, and type a command into the CLI, it will add that command into the queue to be ran after the script finishes. If the script ends with an abort(), the rest of the queue will be discarded and any commands the user wanted ran won't be. If you end with exit, those commands will indeed be run. Personally in an adventure using script, I'd prefer the rest of my commands NOT to be run in the event an error occurs, in case I planned on using up the remainder of my adventures in another location. Again, however, it's an opinion thing, I think.
 

Instalite

New member
Huh, editing the post title doesn't change the thread title.

Version 0.2 adds a feature to allow olfacting survivors semi-intelligently. The offending switch is unchanged because it would be literally impossible for the default case to be executed, so I'm philosophically opposed to it.
 
Top