Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script additions #272

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

andreus791
Copy link
Contributor

States.GroupOrdersBlocked, States.PlayerTeam, States.GetAllTeams

@Kromster80
Copy link
Owner

Please test these scripts in SP. It seems they might be crashing there

@andreus791
Copy link
Contributor Author

Tested, works well for MP but returns -1 for SP teams. Needs more work ;)

@@ -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
Copy link
Collaborator

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).

for I := 1 to gGame.Networking.NetPlayers.Count do
begin
NetIndex := gGame.Networking.NetPlayers.PlayerIndexToLocal(I);
SetLength(Result, Length(Result) + 1);
Copy link
Collaborator

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.

@Kromster80
Copy link
Owner

I agree with @lewinjh, we could accept the script commands to be "just for MP".
But first, it would be required to resolve #288, so we don't have to redo these script commands when Teams-Alliances resolution is found and implemented.

@Kromster80
Copy link
Owner

#288 needs to be resolved first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants