Discussion Best coding interface for event-based tutorial

SerraAvenger

Cuz I can
Reaction score
234
So I want to do something similar to a quest system, just for tutorials.

Tutorials are currently simple containers of sorted t_nodes (tutorial nodes).
These t_nodes contain the event and action data.

Now the question is, how should the creation of such tutorials and t_nodes look like?

The current interface is rather messy.


we first need to create tutorial and t_nodes.
Then we have to manually register the events (this is the part that bothers me the most!)
JASS:

TriggerRegister[...]( my_t_node.trig, [...] );

Then we have to manually set non-standard actions (eg if a t_node shall be interactive)
JASS:

my_t_node.action = function ( player p, t_node n ) -> boolean {
            return true; };// returns true if the next t_node can be started

And finally, we still have to add the t_nodes to our tutorial.
The last step can easily be omitted by just implicitely adding t_nodes to the last created tutorial, so that's fine.
What really bothers me the most is the need to manually register the trigger to the event...
It is completely asyntactical, clumsy, requires access to lower level data of the t_node and and and.

What is the best way around this?
If you think that the whole coding scheme is flawed and should be changed, please state that and make suggestions for a better scheme.

Best wishes, SerraAvenger
 

Laiev

Hey Listen!!
Reaction score
188
and what is this N?

JASS:
function ( player p, t_node n )


forget some , or something like this? because every code language you can't name a thing with space :p
 

SerraAvenger

Cuz I can
Reaction score
234
and what is this N?

JASS:
function( player p, t_node n ) -> boolean

"t_node n"
is the t_node which's actions are triggered, while p is the player that triggered the action.

In fact, if the event doesn't respond to "GetTriggeringPlayer", you even have to make that one yourself:
JASS:
my_t_node.event_parser = function() -> player { return ...; }


btw, that excerpt is from working test code, I only removed the content of the function since it's not interesting for the discussion.

EDIT:
PS: whitespace.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top