Blockland Forums > Modification Help
Iban Explains it All
Treynolds416:
Let me try it out, guys, thanks
Edit: Does not work
After tracing the console, this is what it gave me:
--- Code: ---Entering ConsoleEntry::eval()
==>servercmdobjtest();
Entering servercmdobjtest()
Add-Ons/Script_Wiremod/server.cs (5): Unable to find object: '' attempting to call function 'getEyeVector'
BackTrace: ->ConsoleEntry::eval->servercmdobjtest
Add-Ons/Script_Wiremod/server.cs (6): Unable to find object: '' attempting to call function 'getEyePoint'
BackTrace: ->ConsoleEntry::eval->servercmdobjtest
Leaving servercmdobjtest() - return 0
Leaving ConsoleEntry::eval() - return
--- End code ---
And I didn't change anything in the script:
--- Code: ---function servercmdobjtest()
{
%scale = vectorScale(%obj.getEyeVector(),100);
%ray = containerRaycast(%obj.getEyePoint(),%scale,$Typemasks::fxBrickObjectType);
if(isObject(firstWord(%ray)))
{
%brick = firstWord(%ray);
echo(%brick.getPosition());
}
}
--- End code ---
Also, Death, look in the Torque Appendix or type DumpConsoleFunctions(); into the console and save as a text file.
Iban:
Sigh.
I have no idea how I can make this any clearer. Variables cannot be pulled out of thin air.
--- Code: ---function serverCmdDoObjTest(%client)
{
%obj = %client.player;
--- End code ---
Treynolds416:
--- Quote from: Iban on March 21, 2011, 09:28:38 PM ---Sigh.
I have no idea how I can make this any clearer. Variables cannot be pulled out of thin air.
--- Code: ---function serverCmdDoObjTest(%client)
{
%obj = %client.player;
--- End code ---
--- End quote ---
I thought %obj was already defined, sorry
Edit: Actually, it didn't fix anything, still returns the same error message.
Help?
Red_Guy:
please post your modified script -- the ENTIRE .cs file
and the console errors.
Then we can probably help you.
Or you can try some debugging yourself. -- put echo() statements for your variables. in particular, the ones giving errors.
Treynolds416:
I figured out the problem!
lilboarder's Object check is somehow corrupt. I have no idea why, but by removing it the script worked.
Here is the entire code I used for testing purposes:
--- Code: ---function servercmdobjtest(%client)
{
ClientCmdCenterPrint("You activated the function", 3);
%obj = %client.player;
%scale = vectorScale(%obj.getEyeVector(),100);
%ray = containerRaycast(%obj.getEyePoint(),%scale,$Typemasks::fxBrickObjectType);
%brick = firstWord(%ray);
messageClient(%client,'',%brick.getPosition());
ClientCmdCenterPrint("It probably didn't work", 3);
}
--- End code ---
Edit: Interesting.
It only seems able to pick up on baseplates.
When I try it on another brick the console says
--- Code: ---Add-Ons/Script_Wiremod/server.cs (11): Unable to find object: '0' attempting to call function 'getPosition'
BackTrace: ->servercmdobjtest
--- End code ---