adventuregamestudio / ags-manual

AGS documentation.
https://adventuregamestudio.github.io/ags-manual/
MIT License
28 stars 9 forks source link

[3.6.1] Interaction callbacks: new parameters #230

Closed ericoporto closed 10 months ago

ericoporto commented 1 year ago

Script API:

Regarding expanded interaction functions, these are functions connected to Look at, Interact, Talk to and other similar events. They all now may have 2 parameters: a pointer to object, and cursor mode, similar to the following examples:

function Ego_Interact(Character *c, CursorMode mode)
function oObject1_Look(Object *o, CursorMode mode)

Exceptions:

  • Hotspot WalkOn and MouseOver events do not have CursorMode parameter.
  • All Region events do not have CursorMode parameter.

The purpose of this addition is to improve situation where you connect same function to multiple events and/or multiple objects at once. In such case you will be able to distinguish object and mode for which the function is actually called.

These new parameters are optional. If you don't have them declared in script, they will be ignored by the engine, and your script is going to run as before.

From forums

ericoporto commented 1 year ago

These interactions and events in general are described here: EventTypes.

This file is directly linked from Home.

I think maybe the format of this file could be improved somehow (adding the default generated events by the editor, like room_Load?), there are six things with their events described in the file:

I was thinking in keeping it as a master file and breaking the others to their own files, having each event as a heading. Or just having each event as h4 type of heading - we only use those in the tutorials and in the engine plugin api description.

I verified h4 does gets added to the index, so perhaps keep those in one file for now.

ivan-mogilko commented 11 months ago

The event functions are also mentioned in the tutorial, on these pages: https://github.com/adventuregamestudio/ags-manual/wiki/acintro3 https://github.com/adventuregamestudio/ags-manual/wiki/acintro4 https://github.com/adventuregamestudio/ags-manual/wiki/acintro5 https://github.com/adventuregamestudio/ags-manual/wiki/acintro7 https://github.com/adventuregamestudio/ags-manual/wiki/acintro8 some of these are present as a code, but some unfortunately are on a screenshot...

But maybe it's not necessary to do everywhere.

ivan-mogilko commented 10 months ago

Updated and reorganized Event Types topic: https://github.com/adventuregamestudio/ags-manual/wiki/EventTypes/_compare/bf1c874955ec8faa59ba0bccaed47943ec941bba...391ae7ebb78ba32f72bbca482f12fe2c757ceb7b

I think that will do for now, but of course the topic may be improved further.