ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Ejecting... (Sdk)
Ejecting... // SdkvelenoDec 6, 1998, 3:14pm
Ok, I'm back...
I have my bot stationed at a specific place in my own world. What he's SUPPOSED to do, is check the person's citizen number when they walk too close, and if it matches one of the numbers on the right's list, then it lets em pass, otherwise... ejection. My only problem is getting the bot to find the person's citizen number... anything i've tried so far has just resulted in a core dump of the program every time someone got too close... I need a way to get the bot to recognize citizen number of the avatar on approach. Not from the chat line, which is my problem. Anybody got a solution? or something close to it that would serve the same purpose is plenty well fine.... x@x.com (xelag)Dec 7, 1998, 11:38pm
Sure. If you install the event handler for AW_EVENT_AVATAR_ADD whith
aw_event_set(...), then, in the event handler, aw_string(AW_AVATAR_NAME) gives you the name of the avatar when it is detected by the bot. You can then ask for the citizen number of the avatar using rc = aw_citizen_attributes_by_name(<name of avatar>). This will return either: (i) inmediately, then if rc = 0 you find the citizen number using aw_int(AW_CITIZEN_NUMBER), if rc <> 0 then its not a citizen and the values of aw_int and aw_string are worthless. (ii) using a callback function. If you use callbacks, then make sure you ask again for the citizen name with aw_string(AW_CITIZEN_NAME), to make sure its the same name you sent. The advantage of the callback is you dont have to wait for aw_citizen_attributes_by_name to return. [View Quote] >Ok, I'm back... >I have my bot stationed at a specific place in my own world. What he's >SUPPOSED to do, is check the person's citizen number when they walk too >close, and if it matches one of the numbers on the right's list, then it >lets em pass, otherwise... ejection. My only problem is getting the bot >to find the person's citizen number... anything i've tried so far has >just resulted in a core dump of the program every time someone got too >close... >I need a way to get the bot to recognize citizen number of the avatar on >approach. Not from the chat line, which is my problem. Anybody got a >solution? or something close to it that would serve the same purpose is >plenty well fine.... velenoDec 8, 1998, 12:28am
I know about that already. My problem is not in getting it to recognize
them... it's in getting their avatar number from the avatar_change(). Getting the number from the avatar_add() won't do me much good since it doesn't keep it. I have the ability to get the information out of the rights list about the citnums. and have gotten that to work successfully... (asking if the number is a PS or not, but from the chatline) what I need is for the bot to be able to do the same function, but not voiced by a third party. Anybody understand what I'm trying to say? [View Quote] > Sure. If you install the event handler for AW_EVENT_AVATAR_ADD whith > aw_event_set(...), then, in the event handler, > aw_string(AW_AVATAR_NAME) gives you the name of the avatar when it is > detected by the bot. You can then ask for the citizen number of the > avatar using rc = aw_citizen_attributes_by_name(<name of avatar>). > This will return either: > > (i) inmediately, then if rc = 0 you find the citizen number using > aw_int(AW_CITIZEN_NUMBER), if rc <> 0 then its not a citizen and the > values of aw_int and aw_string are worthless. > > (ii) using a callback function. If you use callbacks, then make sure > you ask again for the citizen name with aw_string(AW_CITIZEN_NAME), to > make sure its the same name you sent. The advantage of the callback is > you dont have to wait for aw_citizen_attributes_by_name to return. > [View Quote] x@x.com (xelag)Dec 8, 1998, 3:12am
You dont get the avatar number (whats that?) from anywhere, Veleno.
You can retreive the Name and Session number directly from 3 places: avatar_add, avatar_change, avatar_delete. What you do with this information, which is volatile, is entirely up to you. You can store it or use it immediately, as you wish. Its not less volatile that the chatline, btw. To get the citizen number, you need the Name of the avatar, obtained from one of the 3 above mentioned places (or from the chatline). Those 3 places only 'exist' if you know how to install an event handler. Then you have to ask the universe server for the citizen number yourself, by sending the Name through an aw api call. There is no other way. The Session number is not a citizen number: it changes, for instance, when the server is temporarily disconnected, or if an avatar relogs. I hope this helps, good luck. [View Quote] >I know about that already. My problem is not in getting it to recognize >them... it's in getting their avatar number from the avatar_change(). Getting >the number from the avatar_add() won't do me much good since it doesn't keep >it. I have the ability to get the information out of the rights list about >the citnums. and have gotten that to work successfully... (asking if the >number is a PS or not, but from the chatline) what I need is for the bot to >be able to do the same function, but not voiced by a third party. Anybody >understand what I'm trying to say? > [View Quote] velenoDec 8, 1998, 8:00pm
Sorry if I was a bit confusing XelaG. I am well aware the properties of the
session number. what I meant by the 'avatar number' was the citizen's number. It wouldn't do me much good to just have the value of their citizen number stored in a variable from the avatar_add event. What I really need is to get the avatar_change to see the avatar's name and then I can call the event to get the number, already. [View Quote] > You dont get the avatar number (whats that?) from anywhere, Veleno. > > You can retreive the Name and Session number directly from 3 places: > avatar_add, > avatar_change, > avatar_delete. > > What you do with this information, which is volatile, is entirely up > to you. You can store it or use it immediately, as you wish. Its not > less volatile that the chatline, btw. > > To get the citizen number, you need the Name of the avatar, obtained > from one of the 3 above mentioned places (or from the chatline). Those > 3 places only 'exist' if you know how to install an event handler. > Then you have to ask the universe server for the citizen number > yourself, by sending the Name through an aw api call. There is no > other way. > > The Session number is not a citizen number: it changes, for instance, > when the server is temporarily disconnected, or if an avatar relogs. > > I hope this helps, good luck. > [View Quote] x@x.com (xelag)Dec 9, 1998, 5:39am
Well, if i get it right this time, you could proceed as i pointed out
in my first answer for AW_EVENT_AVATAR_ADD: get aw_string(AW_AVATAR_NAME) from AW_EVENT_AVATAR_CHANGE. That IS the name of the avatar that caused the event by changing position or something else. All 3 events mentioned in my 2nd posting, i.e. avatar_add, avatar_change, avatar_delete. give you access to the SAME TYPE of information, only on different occasions: (language: Delphi Pascal) AvName := aw_string(AW_AVATAR_NAME); // <-- NAME. AvSession := aw_int(AW_AVATAR_SESSION); // For which bot. AvNS := aw_int(AW_AVATAR_Z); // Coords of AvWE := aw_int(AW_AVATAR_X); // avatar. AvAltitude := aw_int(AW_AVATAR_Y); AvRotation := aw_int(AW_AVATAR_YAW); AvAvatar := aw_int(AW_AVATAR_TYPE); // Appearence. AvGesture := aw_int(AW_AVATAR_GESTURE); // Gesture. The API reference is unclear, states these attributes only for avatar_add. Took me a while to figure out. Hope this helps. XelaG. [View Quote] >Sorry if I was a bit confusing XelaG. I am well aware the properties of the >session number. what I meant by the 'avatar number' was the citizen's number. It >wouldn't do me much good to just have the value of their citizen number stored in >a variable from the avatar_add event. What I really need is to get the >avatar_change to see the avatar's name and then I can call the event to get the >number, already. > [View Quote] x@x.com (xelag)Dec 9, 1998, 5:50am
Rectification:
BtInst := aw_instance; // For which bot AvSession := aw_int(AW_AVATAR_SESSION); // Session number of avatar Sorry for the confusion ;o) roland vilettDec 10, 1998, 1:40am
A slight clarification: only AW_AVATAR_NAME and AW_AVATAR_SESSION are
available during the AW_EVENT_AVATAR_DELETE event. Sorry the docs were incomplete on this matter, I will update them shortly. -Roland [View Quote] canopusDec 10, 1998, 3:54am
Sometimes when there are several bots in one program all getting
AW_EVENT_AVATAR_DELETE events, it seems that AW_AVATAR_NAME behaves strangely, while AW_AVATAR_SESSION behaves reliably. The first bot (or the first two bots) get the correct name, and the second and third (or just the third) get the wrong name. AW_EVENT_AVATAR_CHANGE doesn't have this problem. Is the cache for the name being purged too soon? (See XelaG's thread of 11/25 - 11/29.) [View Quote] > A slight clarification: only AW_AVATAR_NAME and AW_AVATAR_SESSION are > available during the AW_EVENT_AVATAR_DELETE event. Sorry the docs were > incomplete on this matter, I will update them shortly. > > -Roland > [View Quote] roland vilettDec 10, 1998, 6:51pm
Ah! You are correct. The current implementation of providing
AW_AVATAR_NAME during the AW_EVENT_AVATAR_DELETE event is broken in the multi-bot-instance case. I will have a fix for this as soon as possible... Thanks, Roland [View Quote] walter knupeDec 11, 1998, 3:40pm
Ah ! that gives much sense to many assumptions in the Xelag thread.. thanxs
:) and clearifies some odd name problems in my multiinstance prog i didn't examine yet... Walter Roland Vilett schrieb in Nachricht <36703401.0 at homer>... >Ah! You are correct. The current implementation of providing >AW_AVATAR_NAME during the AW_EVENT_AVATAR_DELETE event is broken in the >multi-bot-instance case. I will have a fix for this as soon as possible... > >Thanks, >Roland |