ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Local Console Messages? (Sdk)
Local Console Messages? // Sdk.duo.Aug 19, 2002, 8:33pm
Is there a session ID that allows you to create a console message only
within the bots range? If so please tell me. the derekAug 19, 2002, 11:44pm
youd have to keep track of where everyone is and issue messages to the
people near it on by one [View Quote] joemanAug 20, 2002, 12:22am
Yes, but due to the fact that your using VB, and console messaging only the
people near the bot is out of your grasp. -Joe [View Quote] the derekAug 20, 2002, 2:54am
as far as i know there is nothing in the c++ sdk that would let you do that
what youd have to do is keep track of where eveyone is (youd need to know how to use the memory functions of the windows API) and then when you want to do a console message to people within a certain radius, just check each person one by one from memory... unless you try to do it without using memory directly it wont lag [View Quote] .duo.Aug 20, 2002, 10:01am
I amde a set of functions that added session numbers to a list of people
during EventAvatarAdd using an array of sessions. The place where new session numbers should be are is saved by a long, and it sends messages, but it seems to not read the session ids from the array )-: [View Quote] strike rapierAug 20, 2002, 4:22pm
Function HypBetween2D(X1 As Long, Z1 As Long, X2 As Long, Z2 As Long)
'This allows you to find the distance between 4 points allong the hyp 'and is used for mapping and rangefinding. It uses X and Z (NS / EW) Dim DistanceOnTarget As Long, XDistance As Long, ZDistance As Long XDistance = X2 - X1 ZDistance = Z2 - Z2 HypBetween2D = Squ((XDistance ^ 2) + (ZDistance ^ 2)) End Function A loop with all your av's in from the location of the bot. Vualla. - Mark [View Quote] deconstructorAug 20, 2002, 5:29pm
STL :) This is what I do to keep track of everyone in the scene.
(Ignore the myBotClass::, I copied this out of my own bots--just change the functions to whatever you are using, you get the idea) #include <map> using namespace std; typedef struct { char* citName; int X; int Y; int Z; int citNum; int avatar; int gesture; } avInfo; map<int,avInfo> avatars; // Info on everyone in the scene void myBotClass::awEventAvatarAdd(char* avatarName,int avatarSession,int X,int Z,int Y,int yaw,int avatarCitNum,int avatarType,int avatarGesture){ // Store avatar info avatars[avatarSession].citName=avatarName; avatars[avatarSession].X=X; avatars[avatarSession].Y=Y; avatars[avatarSession].Z=Z; avatars[avatarSession].citNum=avatarCitNum; avatars[avatarSession].avatar=avatarType; avatars[avatarSession].gesture=avatarGesture; dbgPrint("%s entered the scene. Citizen: %i Session: %i",avatarName,avatarCitNum,avatarSession); } void myBotClass::awEventAvatarChange(char* avatarName,int avatarSession,int X,int Z,int Y,int yaw,int avatarType,int avatarGesture){ avatars[avatarSession].citName=avatarName; avatars[avatarSession].X=X; avatars[avatarSession].Y=Y; avatars[avatarSession].Z=Z; avatars[avatarSession].avatar=avatarType; avatars[avatarSession].gesture=avatarGesture; } void myBotClass::awEventAvatarDelete(char* avatarName,int avatarSession){ avatars.erase(avatarSession); } This way, you have a little spybot that keeps tabs on everyone in the scene. Deconstructor chiklitAug 21, 2002, 10:05pm
".duo." <ncommons at juno.com> wrote in
news:3d622fa9$1 at server1.Activeworlds.com: > I amde a set of functions that added session numbers to a list of > people during EventAvatarAdd using an array of sessions. The place > where new session numbers should be are is saved by a long, and it > sends messages, but it seems to not read the session ids from the [View Quote] What I use in my bot is an invisible list box. on the aw_event_avatar_add it adds the session number to the invisible one and the name to the visable one. strike rapierAug 22, 2002, 12:08am
Tsk Tsk Tsk, as Grimble put it to me, never use Graphical components when you dont need them...
- Mark kahAug 22, 2002, 6:40am
"chiklit" <chiklit at funetwork.net> wrote in
news:Xns9271C878DFFABchiklitfunetworknet at 64.94.241.201: > What I use in my bot is an invisible list box. on the > aw_event_avatar_add it adds the session number to the invisible one and > the name to the visable one. That's the newbie-ish uncorrect way. The most common correct way is to use an array. With an array you can also skip having any listboxes at all: <code language="VB"> Private Type AwUser AwName As String AwSession As Long End Type Dim AwUsers() As AwUser Dim AUIdx As Long 'this one should be set to -1 at init Private Sub sdk_EventAvatarAdd() AUIdx = AUIdx + 1 AwUsers(AUIdx).AwName = sdk.AwAvatarName AwUsers(AUIdx).AwSession = sdk.AwAvatarSession End Sub </code> KAH kahAug 22, 2002, 2:59pm
"bluemoon8963" <bluemoon8963 at hotmail.com> wrote in
news:3d64ec46$1 at server1.Activeworlds.com: > If it's uncorrect then why does it work? :) By uncorrect I didn't say it wasn't working, but it's not the way it should be done, it's not a very good solution to the problem. :-)) KAH |