-
Notifications
You must be signed in to change notification settings - Fork 91
Script additions #272
base: master
Are you sure you want to change the base?
Script additions #272
Conversation
Please test these scripts in SP. It seems they might be crashing there |
Tested, works well for MP but returns -1 for SP teams. Needs more work ;) |
src/scripting/KM_ScriptingStates.pas
Outdated
@@ -507,6 +511,31 @@ function TKMScriptStates.GameTime: Cardinal; | |||
end; | |||
|
|||
|
|||
//* Version: 7000+ | |||
//* Returns an array with IDs of teams for all players | |||
//* Result: Array of team IDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear what this function returns. Is it a mapping (lookup table) from Hand Index to Team? (that would make the most sense for the script). In that case you should iterate over hands count not NetPlayers count (so the length of the returned array is always hands count).
Otherwise it's unclear how this function could be useful to the script, since the indexes of the array will not match up with player indexes that the script uses in other functions (e.g. the player/hand index in Actions.OverlayTextSet would not be the same as the index into the array returned by this function).
src/scripting/KM_ScriptingStates.pas
Outdated
for I := 1 to gGame.Networking.NetPlayers.Count do | ||
begin | ||
NetIndex := gGame.Networking.NetPlayers.PlayerIndexToLocal(I); | ||
SetLength(Result, Length(Result) + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to resize the array every loop (inefficient), just set the size once at the start.
#288 needs to be resolved first |
States.GroupOrdersBlocked, States.PlayerTeam, States.GetAllTeams