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

Room Numbers as enum #2625

Open
ivan-mogilko opened this issue Dec 20, 2024 · 0 comments
Open

Room Numbers as enum #2625

ivan-mogilko opened this issue Dec 20, 2024 · 0 comments
Labels
ags 4 related to the ags4 development context: script api type: enhancement a suggestion or necessity to have something improved what: editor related to the game editor

Comments

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented Dec 20, 2024

This is from an interesting proposal in comments here.

Autogenerate eRoomName enum constants for rooms. Have these constants declared in a form rmRoomName, where RoomName is converted from Room's Description string with all invalid symbols removed (meaning - symbols that are not allowed to be in script keyword).

Alternatively, have a separate Room's property for this. Probably a Name or ScriptName, which is restricted to be script-compatible, just like any other script name.

Change the signature of the ChangeRoom function to Character::ChangeRoom(eRoomNumber room).
Similarly change Character.Room to return eRoomNumber.

For example, this would result in a generated enum like:

enum eRoomName 
{
    rmKitchen = 1,
    rmAttic = 2,
    ...
    rmKeypad = 301,
    rmTitleSceen = 302,
    ...
}

Then users can code player.ChangeRoom(rmLivingRoom); instead of player.ChangeRoom(37); if they wish. The room names will appear in Autocomplete, making it easier to find and type them.

See Also: #1175

@ivan-mogilko ivan-mogilko added type: enhancement a suggestion or necessity to have something improved what: editor related to the game editor ags 4 related to the ags4 development context: script api labels Dec 20, 2024
@ivan-mogilko ivan-mogilko changed the title Generate room numbers as enum Room Numbers as enum Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ags 4 related to the ags4 development context: script api type: enhancement a suggestion or necessity to have something improved what: editor related to the game editor
Projects
None yet
Development

No branches or pull requests

1 participant