Difference between revisions of "GetFreeSel"

From NexusWiki
Jump to: navigation, search
(Created page with '<big>'''GetFreeSel''' ''();''</big> :It returns a list ID that is empty and that hasn’t been used so far. You can use this, and the DeleteSelect() typically in subroutines to ...')
 
 
Line 7: Line 7:
 
<pre>MyList := GetFreeSel();
 
<pre>MyList := GetFreeSel();
 
Select(MyList, S.device);</pre>
 
Select(MyList, S.device);</pre>
 +
 +
 +
==Possible pitfall==
  
 
:Be careful with this: subsequent calls to GetFreeSel() will '''always''' return the same list ID, unless you used this list inbetween these calls. The following is WRONG:
 
:Be careful with this: subsequent calls to GetFreeSel() will '''always''' return the same list ID, unless you used this list inbetween these calls. The following is WRONG:

Latest revision as of 12:53, 17 June 2009

GetFreeSel ();

It returns a list ID that is empty and that hasn’t been used so far. You can use this, and the DeleteSelect() typically in subroutines to create and delete our lists.


Example: creating an empty list and filling it with devices

MyList := GetFreeSel();
Select(MyList, S.device);


Possible pitfall

Be careful with this: subsequent calls to GetFreeSel() will always return the same list ID, unless you used this list inbetween these calls. The following is WRONG:
MyFirstList := GetFreeSel();
MySecondList := GetFreeSel();
Select(MyFirstList, s.engine);
Select(MySecondList, s.weapon);
Both 'MyFirstList' and 'MySecondList' point to the same list, so 'MyFirstList' doesn't contain engines, but weapons instead! This is because after the first call to GetFreeSel(), the list hadn't been used - so the second call to GetFreeSel() actually returns the exact same list ID! The following would have been RIGHT:
MyFirstList := GetFreeSel();
Select(MyFirstList, s.engine);
MySecondList := GetFreeSel();
Select(MySecondList, s.weapon);
Now both 'MyFirstList' and 'MySecondList' point to different list IDs and can be handled seperatedly.

Script structure commands


Structure
Choose - ChooseFirst - Delay - If - IsValid - When - While

Variable manager
Ceil - Cos - Exp - Floor - Log - Max - Min - Not - Pow - Rnd - Round - Sin - Sqrt - Col - CHeat - CPlanck - CInv - CAdd - CAdda - CMul - CLerp - CBrig - CEqu - GetVal - IsName - Rot - V2Rot - R2Vec - Requ - RNull - SLen - SCat - SSub - SNum - SNumPad - SCmp - SiCmp - Set - SetVal - XfIdent - XfTran - XfRotX - XfRotY - XfRotZ - XfRot - XfScale - XfInv - XfTran - XfMul - Vec - VNull - VRandomOrth - VLen - VSqLen - VNorm - VNeg - VAdd - VSub - VMul - VDot - VCross - VEqu - VXform

Selection
AddItem - AddList - AllNum - Copy - CopyIf - DeleteSelect - Deselect - Dim - Empty - ExecList - obj:Colony - FindUnder - FirstNotScanned - GetFreeSel - GetN - IndexOf - InSelection - MaxList - NumOf - Pick - PickFirst - PickMax - PickN - RemoveFirst - RemoveItem - Select - SelectBoats - SelectDevices - SelectEx - SelectShips - SelWeightMul - SetN -SubList

Event handling
Call - ClearTimer - Disable - Enable - EventEx - LocalEvent - MEvent - PEvent - Return - RootEvent - Timer - StartTimer - UCall - UEvent - UTimer - EnableGUIEvents - RequestFiredEvent - obj:tRequestCriticalDamageEvent - obj:tRequestDetectionEvent - obj:tRequestEnergyOnMax - obj:tRequestNoShipsInRangeEvent - obj:tRequestOverforceEvent - obj:tRequestShipInRangeEvent

Statemachine
ChangeState - ChangeTick - GetMachine - IsInState - LeaveState

Multiplay
MpGameOver - MpGetPlayer - MpGetPlayerCount - MpGetPlayerKills - MpGetPlayerGain - MpGetTeamKills - MpGetTeamGain - MpGetTeamRace - MpGetWinningCondition - MpGetWinningConditionParam - MpHoldPrepare - MpHoldPrepare - MpIsIndividual - MpIsPlayerValid - MpEnableJumpIn - MpEnableJumpOut - MpSetDead - MpSetTeamGain - MpSetPlayerGain - MpSetWinnerTeam - MpSetWinnerPlayer - MpSpawnPoint - SetSceneRadius


- view all commands -