Previous Blog Next Blog
Prev/Next Blog
by date

Finally back on the wagon

Finally back on the wagon
Name:Ben Younkins 
Date Posted:Aug 24, 2006
Rating:2.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Ben Younkins

Blog post
Argh, I have spent way too much time away from this, either doing home improvement or else working on things like setting up my new PDA or working with my wiki. Right now I'm on page 137 of 3DGPAi1, reviewing the large block of code that they suddenly throw at you. Thanks to me being anal retentive, I really feel like I should understand this before moving on. There's a good chance that this is something that's going to become clearer in further work, but right now I'm hung up on the pathlist line (line 112 acc'ding to Notepad++).


$pathList = $addonList !$= "" ? $addonList @ ";control;common" : "control;common";


I've been able to adapt my background with Java and C/C++ to get/grok most of this, but I'm thrown by the '!$=' section... and pretty much everything after that. The question mark and (semi)colons make it look like an operand if (ugh, I haven't messed with those in a while).

I think my big problem is that the code sort of tosses you into the deep end, and I'm getting way too hung up on getting the gestalt of everything instead of just hopping atop my surfboard and speeding past. This is also why I never beat Morrowind or Oblivion.

== www.liquidben.com

Recent Blog Posts
List:08/24/06 - Finally back on the wagon
08/03/06 - 3D Game Programming, initial curiosities

Submit ResourceSubmit your own resources!

Edward Smith   (Aug 24, 2006 at 01:05 GMT)
Well maybe its better to look at it this way:

if($addonList !$= "")
{
$pathList = $addonList @ ";control;common";
}
else
{
$pathList = "control;common";
}


Using the ?: is just a smaller fancy line version of the above.

Now:
$addonList !$= ""

Means in say Java:
if( !addonList.equals( "" ) )


or simply:

Does the varible "addonList" which is a String equal as a String value to this String ""




I hope this helps.

NOTE: I think that this statement is also not required at all because it doesn't matter if the String is empty it won't affect the result

So:
$pathList = $addonList @ ";control;common";

Should work just as well in both of the possible cases given?

EDIT: Oh I see now the first ';' would get in the way so this is completely understandable to use a ?: or the if-else version above :-) So disregard my NOTE:
Edited on Aug 24, 2006 01:45 GMT

James Urquhart   (Aug 24, 2006 at 14:12 GMT)
result = <condition> ? <result if true> : <result if false>;
$= is string compare
Edited on Aug 24, 2006 14:13 GMT

You must be a member and be logged in to either append comments or rate this resource.