• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Gah! --- Doh!

Warmonger

Well-known member
I figured out why the nested if thens were not working.
I was forgetting to call the procedure that all that is in for that particular unit.

But still, is nested if thens the only way to check for multiple flags?

Can you guys write a 'case' statement?

When a datafile bombs out AB, instead of closing the app, can't it just go back into the initial load screen to try something else or wait until the file in question can be tried again?




________________________________________________________________
Sent via the WebMail system at lokilaw.com






------------------------ Yahoo! Groups Sponsor --------------------~-->
Meet the McDonald¿s® Lincoln Fry get free digital souvenirs,
Web-only video and bid on the Lincoln Fry prop charity auction.
http://us.click.yahoo.com/UScA5C/fV0JAA/5xWGAA/IMSolB/TM
--------------------------------------------------------------------~->
 
You DO currently need to utilize nested "if" statements to check multiple
conditions. However, there are some very simple tricks that you can use to
eliminate the need in most cases. For example, let's look at the code you
included in your previous post.

if (tagcount[tyTags.Rippers] > 0) & (tagcount[tyTags.AddIn] > 0) then
basestat[In] = stat[In] + 2
endif

You can change this to use a single conditional test that works by using
simple arithmetic instead of boolean logic. Since all you care about is
whether a tag is present, the following will yield the results you want.

if (tagis[tyTags.Rippers] + tagis[tyTags.AddIn] >= 2) then
basestat[In] = stat[In] + 2
endif

The "tagis" test will return 0 or 1. If both conditions are satisfied,
adding them together yeilds a value of 2. So that above gives you exactly
what you want, without the needs for nested tests.

We've already got support for boolean logic within conditionals on our todo
list. But it wasn't a high priority, since most situations can be solved
using the technique I outlined above.

If you want a "case" statement, all you need to do is use a sequence of
"elseif" statements. So it would look like the following.

if (test1) then
...
elseif (test2) then
...
elseif (test3) then
...
else
...
endif

Instead of constantly reloading AB to test your files, use the data file
compiler. Start by loading the Examples files (or something you know
works). Then make changes to your data files. Then try compiling your files
- you can use the <ctrl-C> shortcut if you have all the data file debugging
options enabled. Once the files successfully compile, you can then switch
game systems to load them. Then repeat the process, only loading a game
system after it successfully compiles. If the files compile, the should
load into AB, so you won't ever have AB crashing on you (unless you run
into a bug in AB). There should be additional info about the compiler
within the documentation.

-Rob

At 03:33 PM 2/11/2005 -0700, you wrote:
>I figured out why the nested if thens were not working.
>I was forgetting to call the procedure that all that is in for that
>particular unit.
>
>But still, is nested if thens the only way to check for multiple flags?
>
>Can you guys write a 'case' statement?
>
>When a datafile bombs out AB, instead of closing the app, can't it just go
>back into the initial load screen to try something else or wait until the
>file in question can be tried again?


---------------------------------------------------------------------------
Rob Bowes (rob@wolflair.com) (650) 588-8252
Lone Wolf Development www.wolflair.com



------------------------ Yahoo! Groups Sponsor --------------------~-->
Meet the McDonald¿s® Lincoln Fry get free digital souvenirs,
Web-only video and bid on the Lincoln Fry prop charity auction.
http://us.click.yahoo.com/UScA5C/fV0JAA/5xWGAA/IMSolB/TM
--------------------------------------------------------------------~->
 
Back
Top