Thread

Reason code 200? - add object (Sdk)

Reason code 200? - add object // Sdk

1  |  

chris langton

Nov 18, 1998, 3:58pm
Hello..

I'm having a problem adding and changing objects....I'm using the code

exactly as listed in the documentation for aw_object_add and
aw_object_change.

I'm just trying to do something simple - create an object and move it
around....

When I attempt to add an object, the object appears in the world, with
all the
right attributes filled out, but I get "unable to add object (reason
200)"

I don't see reason 200 on the list, but I assume it has something to do
with permissions,
or something like that. I do have bot rights and building
rights...(eminent domain rights).
Restricted radius in the world is 0.

After that, when I attempt to change the object with the object number
returned in
AW_OBJECT_NUMBER and the X and Z coords, I get "Unable to change object
(reason 310)" (no build rights) and then the same error message with
reason 204
(can't find old element).

So - first step is to understand reason 200 - anybody know this one?

Second - I'm a bit unsure about why one needs to identify an object
with both
the object number *and* the X and Z coords - shouldn't the object number
alone
suffice? Or is it not guaranteed to be unique?


The code - (SDK calls look strange because I'm using the version for the
Gnu compiler )

// Create Object

Xcoord = 2000;
Zcoord = 2000;

altitude = 1000;
yaw = 0;

(AWIntSet) (AW_OBJECT_X, Xcoord);
(AWIntSet) (AW_OBJECT_Z, Zcoord);
(AWIntSet) (AW_OBJECT_Y, altitude);
(AWIntSet) (AW_OBJECT_YAW, yaw);

(AWStringSet) (AW_OBJECT_MODEL, "tree01.rwx");
(AWStringSet) (AW_OBJECT_DESCRIPTION, "PineTop Airways");

if (rc = (AWObjectAdd) ())
printf ("Unable to add object (reason %d)\n", rc);
else
puts ("Object added");

object = (AWInt) (AW_OBJECT_NUMBER);

// change object position

(AWWait) (5000);

for (i = 0; i<100; i++) {

deltaX = 1000; /* place holders - These will be random
displacements */
deltaZ = 1000;

(AWIntSet) (AW_OBJECT_OLD_NUMBER, object);
(AWIntSet) (AW_OBJECT_OLD_X, Xcoord);
(AWIntSet) (AW_OBJECT_OLD_Z, Zcoord);
(AWIntSet) (AW_OBJECT_X, Xcoord+deltaX);
(AWIntSet) (AW_OBJECT_Z, Zcoord+deltaZ);

Xcoord += deltaX;
Zcoord += deltaZ;

if (rc = (AWObjectChange) ())
printf ("Unable to change object (reason %d)\n", rc);
else
puts ("Object changed");

(AWWait) (1000);

}

Etc....

Any suggestions appreciated......

Thanks

Chris Langton
AKA MockingBird

canopus

Nov 18, 1998, 4:49pm
See the thread rc 200 above.

[View Quote] > Hello..
>
> I'm having a problem adding and changing objects....I'm using the code
>
> exactly as listed in the documentation for aw_object_add and
> aw_object_change.
>
> I'm just trying to do something simple - create an object and move it
> around....
>
> When I attempt to add an object, the object appears in the world, with
> all the
> right attributes filled out, but I get "unable to add object (reason
> 200)"
>
> I don't see reason 200 on the list, but I assume it has something to do
> with permissions,
> or something like that. I do have bot rights and building
> rights...(eminent domain rights).
> Restricted radius in the world is 0.
>
> After that, when I attempt to change the object with the object number
> returned in
> AW_OBJECT_NUMBER and the X and Z coords, I get "Unable to change object
> (reason 310)" (no build rights) and then the same error message with
> reason 204
> (can't find old element).
>
> So - first step is to understand reason 200 - anybody know this one?
>
> Second - I'm a bit unsure about why one needs to identify an object
> with both
> the object number *and* the X and Z coords - shouldn't the object number
> alone
> suffice? Or is it not guaranteed to be unique?
>
> The code - (SDK calls look strange because I'm using the version for the
> Gnu compiler )
>
> // Create Object
>
> Xcoord = 2000;
> Zcoord = 2000;
>
> altitude = 1000;
> yaw = 0;
>
> (AWIntSet) (AW_OBJECT_X, Xcoord);
> (AWIntSet) (AW_OBJECT_Z, Zcoord);
> (AWIntSet) (AW_OBJECT_Y, altitude);
> (AWIntSet) (AW_OBJECT_YAW, yaw);
>
> (AWStringSet) (AW_OBJECT_MODEL, "tree01.rwx");
> (AWStringSet) (AW_OBJECT_DESCRIPTION, "PineTop Airways");
>
> if (rc = (AWObjectAdd) ())
> printf ("Unable to add object (reason %d)\n", rc);
> else
> puts ("Object added");
>
> object = (AWInt) (AW_OBJECT_NUMBER);
>
> // change object position
>
> (AWWait) (5000);
>
> for (i = 0; i<100; i++) {
>
> deltaX = 1000; /* place holders - These will be random
> displacements */
> deltaZ = 1000;
>
> (AWIntSet) (AW_OBJECT_OLD_NUMBER, object);
> (AWIntSet) (AW_OBJECT_OLD_X, Xcoord);
> (AWIntSet) (AW_OBJECT_OLD_Z, Zcoord);
> (AWIntSet) (AW_OBJECT_X, Xcoord+deltaX);
> (AWIntSet) (AW_OBJECT_Z, Zcoord+deltaZ);
>
> Xcoord += deltaX;
> Zcoord += deltaZ;
>
> if (rc = (AWObjectChange) ())
> printf ("Unable to change object (reason %d)\n", rc);
> else
> puts ("Object changed");
>
> (AWWait) (1000);
>
> }
>
> Etc....
>
> Any suggestions appreciated......
>
> Thanks
>
> Chris Langton
> AKA MockingBird

chris langton

Nov 18, 1998, 5:04pm
<forehead slap> ooops - I missed that thread - thanks!

But I still don't understand why I'm getting the other errors - am I
misidentifying the object somehow?

MockingBird


[View Quote] > See the thread rc 200 above.
>
[View Quote]

canopus

Nov 18, 1998, 5:07pm
Changing an object is really destroying one object and building another
object in its place (see the revised documentation for aw_object_change and
AW_EVENT_OBJECT_ADD). Try filling in all the properties of the new object
version, and see if that helps. (Number+x+z helps to find an object,
certainly.)

Also, why is aw_wait outside the construction loop?

[View Quote] > Hello..
>
> I'm having a problem adding and changing objects....I'm using the code
>
> exactly as listed in the documentation for aw_object_add and
> aw_object_change.
>
> I'm just trying to do something simple - create an object and move it
> around....
>
> When I attempt to add an object, the object appears in the world, with
> all the
> right attributes filled out, but I get "unable to add object (reason
> 200)"
>
> I don't see reason 200 on the list, but I assume it has something to do
> with permissions,
> or something like that. I do have bot rights and building
> rights...(eminent domain rights).
> Restricted radius in the world is 0.
>
> After that, when I attempt to change the object with the object number
> returned in
> AW_OBJECT_NUMBER and the X and Z coords, I get "Unable to change object
> (reason 310)" (no build rights) and then the same error message with
> reason 204
> (can't find old element).
>
> So - first step is to understand reason 200 - anybody know this one?
>
> Second - I'm a bit unsure about why one needs to identify an object
> with both
> the object number *and* the X and Z coords - shouldn't the object number
> alone
> suffice? Or is it not guaranteed to be unique?
>
> The code - (SDK calls look strange because I'm using the version for the
> Gnu compiler )
>
> // Create Object
>
> Xcoord = 2000;
> Zcoord = 2000;
>
> altitude = 1000;
> yaw = 0;
>
> (AWIntSet) (AW_OBJECT_X, Xcoord);
> (AWIntSet) (AW_OBJECT_Z, Zcoord);
> (AWIntSet) (AW_OBJECT_Y, altitude);
> (AWIntSet) (AW_OBJECT_YAW, yaw);
>
> (AWStringSet) (AW_OBJECT_MODEL, "tree01.rwx");
> (AWStringSet) (AW_OBJECT_DESCRIPTION, "PineTop Airways");
>
> if (rc = (AWObjectAdd) ())
> printf ("Unable to add object (reason %d)\n", rc);
> else
> puts ("Object added");
>
> object = (AWInt) (AW_OBJECT_NUMBER);
>
> // change object position
>
> (AWWait) (5000);
>
> for (i = 0; i<100; i++) {
>
> deltaX = 1000; /* place holders - These will be random
> displacements */
> deltaZ = 1000;
>
> (AWIntSet) (AW_OBJECT_OLD_NUMBER, object);
> (AWIntSet) (AW_OBJECT_OLD_X, Xcoord);
> (AWIntSet) (AW_OBJECT_OLD_Z, Zcoord);
> (AWIntSet) (AW_OBJECT_X, Xcoord+deltaX);
> (AWIntSet) (AW_OBJECT_Z, Zcoord+deltaZ);
>
> Xcoord += deltaX;
> Zcoord += deltaZ;
>
> if (rc = (AWObjectChange) ())
> printf ("Unable to change object (reason %d)\n", rc);
> else
> puts ("Object changed");
>
> (AWWait) (1000);
>
> }
>
> Etc....
>
> Any suggestions appreciated......
>
> Thanks
>
> Chris Langton
> AKA MockingBird

chris langton

Nov 18, 1998, 5:08pm
[View Quote] > Changing an object is really destroying one object and building another
> object in its place (see the revised documentation for aw_object_change and
> AW_EVENT_OBJECT_ADD). Try filling in all the properties of the new object
> version, and see if that helps. (Number+x+z helps to find an object,
> certainly.)
>
> Also, why is aw_wait outside the construction loop?
>

Ahhh - so when I change the object I have to obtain a new object number via
AW_OBJECT_NUMBER? that would explain it.....

I have a wait between creating and changing, and then I have a wait in the loop
....
no good reason....!

Thanks

Mock

roland vilett

Nov 18, 1998, 8:10pm
and
>
>Ahhh - so when I change the object I have to obtain a new object number via
>AW_OBJECT_NUMBER? that would explain it.....


Yes, this is correct. Take a close look at the second SDK sample
application. You'll see at the bottom of the routine change_midi() the
program saves the new value of AW_OBJECT_NUMBER after calling
aw_object_change().

I still don't understand how you were running into the rc 200 problem...that
was fixed many builds ago. Were you just on an old build of the SDK?

-Roland

chris langton

Nov 19, 1998, 9:05pm
<sheepish grin>

Mea culpa all the way around, I'm afraid - I should have read the
sample program and docs more carefully....

Just to summarize, my problems were due to:

1) I did not understand that aw_object_change is effectively just
a concatenation of aw_object_delete and aw_object_add. I had
assumed that the object persisted through the change and that one
just had to specify the attributes that were being changed, the
other attributes being carried over without change.

2) <even more sheepish grin> I was, in fact, using an old build
of the SDK, which was the cause of the "reason 200" response.

So - thanks to Canopus and Roland for the clarifications....

Yours in livelier computing...

Chris Langton

AKA MockingBird




[View Quote] >
> Yes, this is correct. Take a close look at the second SDK sample
> application. You'll see at the bottom of the routine change_midi() the
> program saves the new value of AW_OBJECT_NUMBER after calling
> aw_object_change().
>
> I still don't understand how you were running into the rc 200 problem...that
> was fixed many builds ago. Were you just on an old build of the SDK?
>
> -Roland

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn