ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Desperate help needed ASAP (Sdk)
Desperate help needed ASAP // Sdkbyte meOct 24, 1998, 4:15am
Ok,
I'm working on my bot and I have the following code inserted to make a bot spawn when a gesture is played but it doesn't work. and ideas on how to make it work? /*gesture spawning sequnce*/ void handle_avatar_gesture (void) { int rc; if (rc = aw_int(AW_AVATAR_GESTURE)){ aw_create (0, 0, &bot2); aw_say ("Gesture picked up, attempting spawn"); aw_instance_set (bot2); aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, "Zer099Fifty2"); aw_int_set (AW_LOGIN_OWNER, CIT_NUM); aw_string_set (AW_LOGIN_NAME, "Test2"); aw_enter ("Space", 0); aw_int_set (AW_MY_X, 0); aw_int_set (AW_MY_Z, 0); aw_int_set (AW_MY_YAW, 0); aw_say ("Hello I've been spawned"); } } roland vilettOct 24, 1998, 2:11pm
One problem I can see right away is that your first call to aw_say() won't
work because aw_create() changes the default instance (i.e. the bot that subsequent commands apply to) to the instance you just created. You need to either move the call to aw_say() above aw_create() or use more calls to aw_instance_set() to switch back and forth between the two bots. Also you did not call aw_state_change() before your second call to aw_say(), so it won't work either. You have to announce your position in the world at least once by calling aw_state_change() before you can say anything. Beyond that, if you are still having problems I would suggest more liberal checking of return values (especially from calls to aw_enter() which can fail for lots of different reasons) with appropriate bail outs/diagnostic messages so you can quickly identify problems when you run the program. -Roland [View Quote] |