Previous Blog Next Blog
Prev/Next Blog
by date

not a good scripting day

not a good scripting day
Name:J Sears 
Date Posted:Nov 23, 2006
Rating:Not Rated
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for J Sears

Blog post
Well I decided to put freecell on hold for a little bit now that I had learned a bunch and decided to work on the card game I really wanted to get out there. It's a version of a card game some people know but doesn't seem to get played a lot. Thing is anytime I've sen someone play this version of it they've loved it so I figured I'd make it and make it so people can play it online and get it out there.
So I got started using some of the functions I had made up in my freecell program and all was going well got my shuffle going and just for the hell of it have it shuffle the deck 3 times even though 1 shuffle should make a completly random deck. I then made it deal out to just one player (figure I'll get as much of this going on one machine before attempting to work in the netcode) and the deal works just fine.

So now I went to add my mouse code but this time I wanted to use object mouse callbacks instead of scene window call backs. I figure object callback should ease up the code a bit instead of having to search all object under the mouse click everytime. But the thing is I can not get the object mouse callback to work at ALL!!


function t2dSceneObject::onMouseDown( %this, %mod, %worldPos, %mouseClicks )


I couldn't even get an echo to work in this function, I enabled all objects in my scene to use mouse events and nothing. I tried changing t2dSceneObject to card and having all the cards in scene have the class cards but nothing. This drove me insane and I asked for help on the irc chat and nothing. I guess I'll give up and just use the scenewindow mouse events because it should not take several hours to get a object mouse event to work.

Recent Blog Posts
List:01/25/08 - persistance is rewarding
08/28/07 - My thoughts, and my farewell
05/23/07 - some progress on cards
04/23/07 - teaching my computer to play cards
01/03/07 - I'm not dead
12/06/06 - time to learn networking
12/05/06 - back on a decent pace
12/04/06 - back at it

Submit ResourceSubmit your own resources!

Sam Redfern   (Nov 23, 2006 at 10:54 GMT)
I don't use TGB, but from my TGE experience I'd say you might have an object in front of everything else which isn't a t2dsceneobject, and this object is stealing all the mouse events and not passing any of them on to its parent..

Neo Binedell   (Nov 23, 2006 at 15:11 GMT)
Hmm, funny that, I use this all the time, although I would think you wanted a particular class to handle its own mouse clicks not t2dSceneObject, e.g:


function nxIsoTest::init( %this )
{
%this.map = new nxIsoMap(){ scenegraph = IsoSceneGraph; };

%this.map.setUseMouseEvents( true );
}

function nxIsoMap::onMouseDown( %this, %modifier, %point, %clicks )
{
echo( "onMouseDown():" SPC %modifier SPC %point SPC %clicks );
}


David Higgins   (Nov 23, 2006 at 16:19 GMT)
@J,


sceneWindow2D.setUseObjectMouseEvents(true);


You have to enable Object Mouse Event listening -- not 100% true that's the wording of the function, just look it up if it's not :)

Tom Bentz   (Nov 28, 2006 at 10:08 GMT)
I had this same problem. Davids recommendation worked. Is this a bug though? I selected 'Use Mouse Events' under the scripting group for this object and it seems that would enable it but it doesnt.

David Higgins   (Nov 28, 2006 at 14:34 GMT)
@Tom, the SceneWindow has to be told that you want to enable mouse events, and then you must enable mouse events on each object you want to be notified of them -- I believe in the level builder, if you select nothing, and goto 'Edit' -- there is a 'Use Mouse Events' object at the project level -- which is the scenewindow.

This is largely due to performance -- so you don't go clicking 'use mouse events' over and over again in the level builder, without knowing what your doing -- I assume, anyhow.

Bug, no -- intentional design, why, not really sure.

You must be a member and be logged in to either append comments or rate this resource.