Quite recently I renamed some script functions and added a wrapper function for backwards compatibilty. Are there any other functions that we do want to have renamed? I can think of the following:
- GBack_* functions, as there was some confusion about what they should and should not do. Suggesstions for a new name? Mine are: IsBackgroundMaterial*, where * = Solid, SemiSolid, Sky (or could we just create a new function "GetBackgroundMaterial" that reads the background just like GetMaterial does with the foreground?
- *Plr* functions. I'd spell out the "Player" part.
- GBack_* functions, as there was some confusion about what they should and should not do. Suggesstions for a new name? Mine are: IsBackgroundMaterial*, where * = Solid, SemiSolid, Sky (or could we just create a new function "GetBackgroundMaterial" that reads the background just like GetMaterial does with the foreground?
- *Plr* functions. I'd spell out the "Player" part.

>or could we just create a new function "GetBackgroundMaterial" that reads the background just like GetMaterial does with the foreground
This function already exists.
I would not rename the constants though, just the function names.


player0->
player1->
...?
Or
Clonkonaut->
Luchs->
...?
I will immediately create a player named 'Global'.
Don't worry, it'll be
[Edit:] Hm, either that, or let Players be a proplist with unique/non-recurring string keys for each player.
Have we already gotten rid of that
Players[0]->
[Edit:] Hm, either that, or let Players be a proplist with unique/non-recurring string keys for each player.
Have we already gotten rid of that
GetPlayerByIndex
/GetPlayerByID
mess? The option with the proplist would get rid of both…

> Have we already gotten rid of that GetPlayerByIndex
We have not. And it's probably a mess because you need to change a lot of owner stuff when a player is eliminated and another takes the player number.

What do with stuff like: Find_Hostile, DoWealth, GetKiller, InitializePlayer?

DoWealth (also Set and Get): Change to player->DoWealth(int amount)
InitializePlayer: Change to InitializePlayer(proplist player, ..., proplist team) (we'd probably also want to use proplists for teams).




player->GetID()
or something as the integer.
Would you need arrays then?
for (var player in team->GetPlayers())
{
player->DoScore(1);
}
for (var player in Scenario->GetPlayers())
{
if (player.some_property == some_value)
{
--player.another_property;
}
}


One solution would be to build a conversion from the player proplist to int, which returns the number. E.g. like in python, proplists could check for an __int__ function when used as an integer and converted as needed. It would still be a mess because you could never really be sure whether your player got converted to int somewhere.
As older scenarios probably have a lower version number, OC could switch between player proplists and player numbers on the fly. But yeah, there isn't really an unmessy solution (I like the __int__ one though).

I agree with this remark. This is massive in terms of the amoun of scripts that need to be changed.

I'm against just slightly changing some function names here as that would similarly require tons of changes with very little gain. The whole interface isn't great, and inconsistent naming is the least problem.

:s/\vGetPlrExtraData\(\s*(\w+)\s*,\s*/\1->GetExtraData(/
that replaces calls like GetPlrExtraData(plr, GetScoreString());
to plr->GetExtraData(GetScoreString());
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill