Game Development Community

ContainerSearchNext()

by Dumbledore · in Torque Game Engine · 06/16/2008 (8:36 am) · 3 replies

What does containerSearchNext() return?

I imagined that it returns an object ID for that object on the server. So I tried:
// script
%whatverThisIs = containerSearchNext();

//code
Sim::findObject(whateverThisIs, pointerToObj);  // THIS RETURNS NULL

Could someone clarify what containerSearchNext() exactly returns and how I can get a reference to the object from it (server-side)? Thanks.

#1
06/16/2008 (9:25 am)
Perhaps your search has no results ?
try printing %whateverThisIs; it might be -1.
#2
06/16/2008 (12:19 pm)
First of all, some questions:
1) Are you doing this in script? Your syntax appears to imply so.
2) Are you calling the function from the client-side or the Server?

If you are calling this from script, and you are calling it on the Server. Your work is already done: containerSearchNext() returns the SimID of the object found, and in Torque Script the SimID is the object reference

%whateverThisIs = containerSearchNext();

%whateverThisIs.whateverYouWantToDo();

If that's not what you're looking for, I'll need a little more context of what you're doing.
#3
06/17/2008 (8:38 am)
Please use the search functions before posting threads, if you'd searched for "containerSearchNext", the very first item the search returns is called "TorqueScript Console Functions 16 - TDN" which would have answered your question as to what the function returns.

Two things to check:

1 - You must call InitContainerRadiusSearch() prior to running containerSearchNext(), have you passed in the right values, and the mask to that call.

2 - As Orion suggests use echo() to print the results of your call to the console... it should be 0 if no objects are found, the id of an object or it could be a strange result if the call to InitContainerRadiusSearch() wasn't run or was incorrect.