Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Miglioshin on Sun 11/03/2012 21:00:56

Title: actions in chronological order [SOLVED]
Post by: Miglioshin on Sun 11/03/2012 21:00:56
Hi everyone,

I would like to know if there is a way to 'store' actions in a chronological sequence (the sequence the player input them) and than have the character execute them in the same order, possibly in a non blocking way.

Thanks in advance.

Title: Re: actions in chronological order
Post by: Khris on Sun 11/03/2012 21:05:19
There's no built-in way, you have to come up with a way of storing the actions yourself.
What actions are we talking about? Just walking and interacting? Or more complex stuff?
Are you looking for something similar to how Lure of the Temptress did it?
Title: Re: actions in chronological order
Post by: Miglioshin on Sun 11/03/2012 22:07:02
I'm looking for something like:

go there(1), do this animation(1a), call this function(1b) then go there (2), call this function(2a), do this action(2b) and then go there (3).

In this exact order.

For today I came up with something like:
When phases 1 2 3 are true, phase 1 comes before, then 2 and then last 3
But I wanted them to be 2, 1, 3 (the order in wich I clicked them)

Or more precisely I obtained:
2, 1, 1a, 1b, 2a, 3

because I have a loop that checks conditions from 0 to 300 and execute them in that order despite me clicking 255, 121, 65, 300

It result always in doing
go to 255, then go to 65 and execute, go to 121 and execute, go to 255 (again) and execute and finally go to 300 and execute...

I'm triyng to figure out how to explain AGS that click #255 comes before #121 just because i clicked them in that order (and after the functions are finished, clear my inputs from storage).

EDIT: with blocking functions I will obtain this, but just because I can select functions just one at a time, I would like to be able to select multiple of them (while selected are running or by make them run with a run button, it doesn't really matter, but I prefer the real time instead of turn based in making this)

The actions we are talking about are mostly walk there and draw dynamic sprite, or check that parameter and draw a dynamic sprite, mostly...
Title: Re: actions in chronological order
Post by: Khris on Sun 11/03/2012 22:58:39
I'm not sure I understand. Or rather, I can't make heads or tails of what you're saying, I'm afraid.

What do you mean by "clicking 255"? Does your game have a GUI with orders or something?
Or do you want to implement NPCs who go about their tasks in the background?

If I had to guess, you tried something like
  cNpc.Walk(130, 120, eNoBlock);
  cNpc.DoSomething();

and found out that the non-blocking walk is only run after the action?
Title: Re: actions in chronological order [SOLVED]
Post by: Miglioshin on Mon 12/03/2012 14:00:02
I came up with someting that works fine (at least in theory).

I explain:

My project takes place on a virtual grid that has 300 sectors, from 1 to 300.

In each one of theese sectors you can perform a variety of actions (simple or queued) by clicking on them with the appropriate cursor mode/image, carried on by npcs (one or more). Something like popolous, powermonger or sim city...

I have a routine that constantly checks wich sector the player interact with by passing its id# to a global, from top left to bottom right (1 -> 300).

So 255 means a general action performed on sector 255, and so on...

The problem I had was that ags 'performed' the actions in the order in wich it checks the sectors and NOT in the order the player clicks them.

I thought about a correct way to explain ags that it has to follow the order decided by the player, but this morning I realized the following (not in details):

I need an actions struct to have several related varibles/strings/functions.

I need an array for storing actions.

I need a Queuing function that queue clicks into this array.

I need an Execute function that execute the oldest click.

I need a Check function that check if the action has finished and refresh things.

With theese things working as a team I will solve the problem.

Since I can explain this to myself I will surely can explain it to ags.

Thank you Khris for your (usual and appreciated) interest.
Title: Re: actions in chronological order [SOLVED]
Post by: Khris on Mon 12/03/2012 15:09:00
Right, I get it now.
Yes, what you describe is pretty much exactly what I'd have suggested.