Scripting: Lua: If/else cases and how to use it

Posted by Arnumor on Wed 04 Feb 2009 07:28 PM — 2 posts, 12,337 views.

#0
I play an engineer in a mud called Legends of the Jedi. My character build ships, and each ship has 4 components to build on, with several attempts needed to complete each. The ship frames look like this, ones a couple components have been finished:

This looks like the frame for a Delta-Class JV-7 Escort Shuttle
This ship belongs to you.
Components till completion:
Hull: 1500
Circuits: 950
Weapons: 0
Engines: 0

The problem is, when I made a normal trigger that functions via the component displays that show 0 left, it loops, seeing the same '(Component): 0' over and over.

I need to know how to use an ifcheck function to check the engines for completion, and if they're done, then the weapons, and so forth. I'd prefer to have it all in one trigger, if possible.

The command used in-game to build these is 'buildship (ship name, delta in this case) (ship component on frame) (ship part item, which shares the component name on the frame)'

My variables that store which ships and parts to currently work on are as follows:

'Ship' For the shipname.
'ShipPart' For the component on the frame.
'Part' For the part item.

I really only need to change the ShipPart and Part contents, since the ships are all the same model.

I've been trying to figure out a way to go full-auto building ships for a long time, so any help would be appreciated. Keep in mind, I'm a bit of am amateur, so the simplest way of putting it is probably best.
Australia Forum Administrator #1
See: http://www.gammon.com.au/forum/bbshowpost.php?id=8754