MODULE: NoBlock v0.7 - cancelable interactions

Started by Bernie, Mon 12/06/2006 18:47:45

Previous topic - Next topic

Bernie

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

GarageGothic

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:
Code: ags
int myval=Hotspot.GetAtScreenXY(mouse.x, mouse.y).ID;


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


SSH

#2
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
Code: ags
Hotspot *myhotspot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
int myval = 0;
if (myhotspot!=null) myval=myhotspot.ID;


12

Bernie

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

Kweepa

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
Still waiting for Purity of the Surf II

strazer

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 for a quick how-to.

jasonjkay

Sounds great, I'll add it to my site later.
http://www.americangirlscouts.org/agsresources/ - Mods, plugins and templates.

Bernie

#7
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) {}'.

Bernie

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

SMF spam blocked by CleanTalk