Set declaration madness
Originally posted by Second Chance
Here's your problem right here:You can't assign a value to a variable during declaration.pos1 = iMapEntity.FindByName("Lucrecia's Base");
You can assign a variable during declaration. You just have to declare the variable type first:
hmapentity pos1 = iMapEntity.FindByName("Lucrecia's Base");
and for example even 'cast' to a different type:
hsim pos1 = iSim.Cast ( iMapEntity.FindByName("Lucrecia's Base"));
Works using sets and lists too:
list port_list = List.FromSet ( iDockport.DockportsOfType ( iSim.Cast ( turret_ship ), DT_Cargo, DS_Free ) );
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
I'm not sure if I'm being very clear, so here are bad and good examples:
Please Log in or Create an account to join the conversation.
Originally posted by EricMan64
Yes, assigning values during declaration is perfectly fine. The problem here is that all declarations must be made at the beginning of a function or task. Once you do something that is not a declaration, you cannot declare anything more. Assigning a value is not a declaration, so unless it is done on the same line as a declaration, there can be no more declarations after that point.
That's a perfect explanation. It seems this threat becomes a fine beginners guide to pog - coding.
Please Log in or Create an account to join the conversation.
- Second Chance
- Offline
- King of Space
No wait, even better; I plead that it was 5am when I wrote that.
Now it's 3pm. I just woke up, and my head hurts.
That my story, and I'm sticking to it.
Where's the water? [xx(]
mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.
Please Log in or Create an account to join the conversation.
Originally posted by Second Chance
That my story, and I'm sticking to it.
LOL Whats the problem? You were right, I was right and EricMan too.
EricMans explanation was the best for a pog beginner. I think he would make a good teacher/lecturer someday [8D]
We are so deep into the stuff we take too much for granted.
lo-tekk, we're glad to see a new pogger around
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
- Second Chance
- Offline
- King of Space
mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.
Please Log in or Create an account to join the conversation.