godot-escoria / escoria-issues

Central Escoria issue tracker
3 stars 0 forks source link

Document API usage from GDScript #156

Open balloonpopper opened 2 years ago

balloonpopper commented 2 years ago

Is your feature request related to a problem? Please describe. I wanted to update the 10 button puzzle in room8 to change the active state of an ESCitem when you completed the puzzle. After checking the code, and then confirming with StraToN, there's no API command for changing the active status.

Describe the solution you'd like A GDScript API command for setting an ESCItem's active status.

dploeger commented 2 years ago

Isn't set_active used for this? https://docs.escoria-framework.org/en/devel/scripting/z_esc_reference.html#set-active-object-active-api-doc

balloonpopper commented 2 years ago

That's ESC code, I meant as in an API call. Based on the code that's already in the 10 numbers puzzle from room 8 (game/rooms/room08/puzzle/10_buttons_puzzle.gd) , it would be something like

escoria.object_manager.get_object("r8_button_puzzle").set_active("false")

In fact, now that I read a few more of the API pages, it doesn't look like most of the ESC commands have an API equivalent (or am I misunderstanding the API pages?)

dploeger commented 2 years ago

Oh, the code would be:

escoria.object_manager.get_object("r8_button_puzzle").active = false

ESCObjectManager#get_object returns an ESCObject which has an active parameter.

Basically all ESC commands should be mere "facades" of the Escoria API. That might be not the case in some (which we should change then), but usually they are.

balloonpopper commented 2 years ago

Thanks. Figured it out eventually. I'd suggest a section in the documentation that gives examples of how to reference esc objects from gdscript.

dploeger commented 2 years ago

I've modified the issue to reflect a general documentation on how to work with the API, that should include examples like this.