Checker Demo: problem with "new ScriptClass
by Mord · in Torque Game Builder · 01/20/2007 (10:20 pm) · 5 replies
Hey all, I'm working on the checkers network demo and i've come across this bit of code that is giving me errors.
I read that the new keyword was removed. So i was wondering how to get around this.
thanks
new ScriptClass(CheckerBoard);
function CheckerBoard::isBlack(%this, %x, %y)
{
// this will decide if a checkerboard slot is black
if( (%x % 2) && (%y % 2) )
return true;
else if( %x % 2 || %y % 2 )
return false;
else
return true;
}I read that the new keyword was removed. So i was wondering how to get around this.
thanks
#2
new ScriptClass was removed and replaced with ScriptObject.
In this tutorial you won't need to define the object. The checkerboard is a object.
GL
01/21/2007 (4:44 am)
Mord: Just comment out that line. // new ScriptClassnew ScriptClass was removed and replaced with ScriptObject.
In this tutorial you won't need to define the object. The checkerboard is a object.
GL
#3
thanks for the replies.
01/21/2007 (7:38 pm)
Ahh, sorry. Freeze was right. The new ScriptClass was what i saw removed. thanks for the replies.
#4
01/22/2007 (4:14 pm)
Previously you could define a new "ScriptClass" that you could then link to objects. This isn't and wasn't requires so in the end this superfluous creation call was deprecated. Unfortunately it never got removed out of the Checkers Tutorial. Thanks for finding this issue... I now have two different issues with the Checkers Tutorial documented and it will receive some attention before the next release :)
#5
midSpot = %this.getPiece(%newX, %newY);
should be
%midSpot = %this.getPiece(%newX, %newY);
in-----> isLegalMove.
Is this the second issue? What is the second issue?
Also, There seems to be a problem with the "%client" being passed around for the client commands. I don't get any client msgs --- not your turn etc... Had to make some code changes to get it to work. The rest of the code is fine. This part of the code could be fine too... correct me if I'm wrong but I ran though it 2 times. Same results. (did i make the same mistake twice?)
I didn't echo or debug enough to tell you exactly where the %client is lost but it returns 0 or "" can't remember exact value returned , been a few weeks. If you run though the tutorial the end results is a playable network checkers game, minus the few client msgs.
I just thought I point it out if theres going to be a update to it. (Again could I have made the same error twice? maybe!!!)
01/22/2007 (4:55 pm)
Matthew: I had a couple of problems with this tutorial as I ran though it. Did you get this 1?midSpot = %this.getPiece(%newX, %newY);
should be
%midSpot = %this.getPiece(%newX, %newY);
in-----> isLegalMove.
Is this the second issue? What is the second issue?
Also, There seems to be a problem with the "%client" being passed around for the client commands. I don't get any client msgs --- not your turn etc... Had to make some code changes to get it to work. The rest of the code is fine. This part of the code could be fine too... correct me if I'm wrong but I ran though it 2 times. Same results. (did i make the same mistake twice?)
I didn't echo or debug enough to tell you exactly where the %client is lost but it returns 0 or "" can't remember exact value returned , been a few weeks. If you run though the tutorial the end results is a playable network checkers game, minus the few client msgs.
I just thought I point it out if theres going to be a update to it. (Again could I have made the same error twice? maybe!!!)
Torque Owner Ben R Vesco
What kind of errors are you getting from that code?