Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Bernie on Mon 12/06/2006 18:47:45

Title: MODULE: NoBlock v0.7 - cancelable interactions
Post by: Bernie on Mon 12/06/2006 18:47:45
NoBlock v0.7

Big bad bug fixed. Bit of a logic error. Don't use v0.6.

NoBlock simulates the cancelable interactions in Lucas Arts games (Sam'n Max, DOTT). You go 'Open Door', but you can still move your guy elsewhere if you feel like it.

You'd use it like this: Make your GUI with all them fancy buttons and so on, but instead of using RunInteraction, you'd go:

NoBlock.Do(eModeLookat, eLocationHotspot, hotspot number);

Now your character would hop over to the hotspot (either walkto point or custom, your call) and then do his interaction stuff. This also works for objects and characters.

List of functions:

function Do();
function Abort();
function GetAction();
function CancelOnClick();
function DisplayNoGoText();
function SetNoGoText();
function UseHotspotWalkto();
function MoveToWalkToPoints();
function MoveOnlyOnWalkCursor();

function SetHotspotPoint();
function SetObjectPoint();
function SetCharacterPoint();

function GetLocY();
function GetLocX();

Function details can be found in the module's readme file.

Download: http://www.origamihero.com/files/noblock07.zip
Title: Re: Module: MakeDo() - nonblocking interactions
Post by: GarageGothic on Mon 12/06/2006 19:21:13
Quote from: Bernie on Mon 12/06/2006 18:47:45I'd hoped something like int myval=hotspot[Hotspot.GetAtScreenXY(mouse.x, mouse.y)].ID would work, but no go. Is something like that possible at all? Pointers kill my brain dead.

I think this should be enough:
int myval=Hotspot.GetAtScreenXY(mouse.x, mouse.y).ID;

But I'm not sure, perhaps you need a step in between like this:
Hotspot *myhotspot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
int myval = myhotspot.ID;

Title: Re: Module: MakeDo() - nonblocking interactions
Post by: SSH on Mon 12/06/2006 20:07:13
functions that take parameters can't be "pathed" like that, unfortunately, so GG's second script is nearly correct:

Quote from: GarageGothic on Mon 12/06/2006 19:21:13
Hotspot *myhotspot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
int myval = 0;
if (myhotspot!=null) myval=myhotspot.ID;


Title: Re: Module: MakeDo() - nonblocking interactions
Post by: Bernie on Mon 12/06/2006 20:50:25
Fantastic, thanks for the help, GG and SSH. :) Now the module can be used without having to turn old scripting on.

I upgraded the module with three functions - GetHotXY(int x, int y), GetCharXY(int x, int y) and GetObjXY(int x, int y). Now MakeDo(eModeLookat, eLocationHotspot, GetHotXY(mouse.x,mouse.y)); could be used as a subsitute for the old commands.

Download: http://www.origamihero.com/files/makedo05c.zip
Title: Re: Module: MakeDo() - nonblocking interactions
Post by: Kweepa on Mon 12/06/2006 23:54:34
Good stuff!
My only complaint is that "MakeDo" isn't very descriptive.
Perhaps DoCancelable is better? It's longer, but that's what autocomplete is for. :=
Or RunCancelableInteraction? :P
Title: Re: Module: MakeDo() - nonblocking interactions
Post by: strazer on Tue 13/06/2006 00:44:53
Interesting, good idea!
Any chance you could group all these functions together as static functions instead of reserving so many function names? See the guidelines (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26283) for a quick how-to.
Title: Re: Module: MakeDo() - nonblocking interactions
Post by: jasonjkay on Tue 13/06/2006 12:37:30
Sounds great, I'll add it to my site later.
Title: Re: Module: MakeDo() - nonblocking interactions
Post by: Bernie on Tue 13/06/2006 18:06:48
strazer: Good point - I converted it.

Steve: I'm going to call it NoBlock from now on. :D

jasonjkay: Thank you! Please use the new version below.

New version: http://www.origamihero.com/files/noblock07.zip

A few ideas & things you can do with this module:

-Dynamic Walkto points (if you have a moving character, you could run NoBlock.SetCharacterPoint() from repeatedly_execute).

-Easy LEC style status bars. You can make known if an interaction is in progress by checking 'if (NoBlock.GetAction>0) {and then do stuff}', and also retrieve the kind of interaction that's running like this: 'if (NoBlock.GetAction==eModeLookat) {}'.
Title: Re: MODULE: NoBlock 0.7 - cancelable interactions
Post by: Bernie on Fri 16/06/2006 17:49:04
There was a bug in v0.6 that would lead to overwriting walkto-points in other rooms. This has been fixed in v0.7.

DOWNLOAD v0.7 HERE (http://www.origamihero.com/files/noblock07.zip)