Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Army Builder Forums > Army Builder
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Warmonger
Member
Volunteer Data File Author
 
Join Date: Apr 2005
Location: North Western Arizona
Posts: 97

Old February 11th, 2005, 02:07 PM
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/fV0...WGAA/IMSolB/TM
--------------------------------------------------------------------~->
Warmonger is offline   #1 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old February 11th, 2005, 03:03 PM
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/fV0...WGAA/IMSolB/TM
--------------------------------------------------------------------~->
rob is offline   #2 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:13 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.