tomilius // User Search

tomilius // User Search

1  2  |  

Whisper

Jul 15, 2002, 12:07am
heh you arent alone
[View Quote]

more than 1 query?

Jul 15, 2002, 12:17am
I'll bet this is really really obvious, but in the new VB Com DLL, how do
you have more than 1 query? I think its because query doesn't announce
objects that it's announced before, but how do I make it do so?

more than 1 query?

Jul 15, 2002, 2:20am
aha! I've found one way at least....

Dim i1 As Integer, i2 As Integer
For i1 = 0 To 2
For i2 = 0 To 2
aw1.aw_sequence_set AW_SEQUENCE_3X3, i1, i2, 0
Next i2
Next i1
For i1 = 0 To 4
For i2 = 0 To 4
aw1.aw_sequence_set AW_SEQUENCE_5X5, i1, i2, 0
Next i2
Next i1

put that before it queries :) or after maybe.. whatever either will do :D
[View Quote]

more than 1 query?

Jul 15, 2002, 7:32am
thanks cos my way was really buggy and barely worked anyway, hope this does

[View Quote]

more than 1 query?

Jul 15, 2002, 7:39am
hmm - it seems that with either way i have to call the function to query two
times before it works (besides the first time).. so maybe ill just make it
clear the sequences at beginning and end

[View Quote]

more than 1 query?

Jul 15, 2002, 7:45am
wow - that doesn't help either! i guess there must be something wrong with
my code!

[View Quote]

more than 1 query?

Jul 15, 2002, 4:18pm
thanks baron - that's what ive been using :( i don't get it! i have it clear
the sequences but sometimes i have to tell the bot to query like twice.. and
i found out that its not my code :(
[View Quote]

more than 1 query?

Jul 15, 2002, 4:26pm
here's my code:

'On Error Resume Next
Dim i As Integer, j As Integer
If Querying = True Then DoMessage theCurUser, "Please wait until the
current query is over or use CANCEL QUERY.", theCurWhisper: Exit Sub
DoCancel = False
Querying = True
'frmQuery.Show
Set qurUser = theCurUser
qurWhisper = theCurWhisper
cell_z = aw1.aw_int(AW_MY_Z) / 1000 'or whatever
cell_x = aw1.aw_int(AW_MY_X) / 1000 'or whatever
' Set the sector to query
sect_z = aw1.aw_sector_from_cell(cell_z)
sect_x = aw1.aw_sector_from_cell(cell_x)
DoMessage theCurUser, "Starting query...", theCurWhisper
' Perform the query
If FiveXFive = False Then
For i = 0 To 2
For j = 0 To 2
aw1.aw_seq_3x3(i, j) = 0
aw1.aw_seq_3x3(i, j) = 0
aw1.aw_seq_3x3(i, j) = 0
Next j
Next i
aw1.aw_query sect_x, sect_z
Else
For i = 0 To 4
For j = 0 To 4
aw1.aw_seq_5x5(i, j) = 0
aw1.aw_seq_5x5(i, j) = 0
aw1.aw_seq_5x5(i, j) = 0
Next j
Next i
aw1.aw_query_5x5 sect_x, sect_z
End If
'While aw1.aw_bool(AW_QUERY_COMPLETE) = False
' If FiveXFive = False Then
' aw1.aw_query sect_x, sect_z
' Else
' aw1.aw_query_5x5 sect_x, sect_z
' End If
'Wend

timTestFinished = True

I have everything just like Baron's code in the other places, don't know
whats wrong

[View Quote]

more than 1 query?

Jul 15, 2002, 4:31pm
oh yeah and real quick... you'll notice i set the things to 0 three times,
but it didnt help
[View Quote]

VBCOM: Reset the callback? What?

Jul 15, 2002, 6:42pm
I'm having a problem getting the query to work after I've already queried
once without having to call it like 3 times (and yes, at the beginning of
the querynow sub I tell it to reset the sequences), and strike rapier told
me to "unset the callback and reset it again". I'm assuming he's talking
about CallbackQuery .. so I put at the beginning of my QueryNow sub ...
aw1.aw_callback_unset AW_CALLBACK_QUERY and then aw1.aw_callback_set
AW_CALLBACK_QUERY but it didn't help..

[VB SDK] i'm no genius, but I can tell theres a problem here

Jul 30, 2002, 1:32am
I use the VB SDK (the new com dll) and there seems to be a problem with it.
When the bot's window isn't active or visible, the bot doesn't work. The sdk
only receives its events once it becomes active. For example, you log your
bot in and go to Active Worlds and talk to it. It will not do anything or
respond to any events until you make it active, so if you tell it its a
stupid bot or something and have that command programmed in, it won't
respond until you make it active or visible. It took me a long time to say
that, but I just wanted to be clear on the issue at stake. It can be fixed
by setting the priority in Windows XP's Task Manager to Above Normal or High
(but lately even this hasn't worked). There's an API command to make it's
priority high also, but it kind of makes the whole computer slow down when
it's doing anything. I wish there was away around this! Someone help me, I'm
really not a bad person, I just want my bot to work ^_^

[VB SDK] i'm no genius, but I can tell theres a problem here

Jul 30, 2002, 2:12am
I heard it has to do with threading - it has occured with me and another
Windows 98 user. Some registry settings or something, wish I knew how to
tell Windows not to use it for my program specifically though.

[View Quote]

[VB SDK] i'm no genius, but I can tell theres a problem here

Jul 31, 2002, 12:08am
Yes I know, but even though I'm only one of the exceptions (since my
computer for some reason came with this "threaing" enabled) the SDK can at
least not have it enabled.

[View Quote]

[VB SDK] i'm no genius, but I can tell theres a problem here

Jul 31, 2002, 12:18am
I know it must be the VB SDK because I can use programs like Preston and
they work fine :-S maybe I should just forget it

[View Quote]

[VB SDK] i'm no genius, but I can tell theres a problem here

Aug 1, 2002, 8:37pm
Well - I did figure out that it works fine when I make its priority Above
Normal, it was just some of my commands that were obsolete. I will put in a
new post a function that I really need.

[View Quote]

[VB SDK] EventTelegram

Aug 1, 2002, 6:56am
I have visited the SDK site (activeworlds.com/sdk) and the grimmsoft VB SDK
site and cannot seem to find EventTelegram. What is this and how does it
work? I can tell it has something to do with receiving telegrams but bots
can't get telegrams and it doesn't seem to work when I've tried it.

[VB SDK] EventTelegram

Aug 1, 2002, 7:03pm
Yes, we all know that *duh* but it's in the COM DLL and AwSdkOcx5! What's up
with that?

[View Quote]

[VB SDK] Much needed to be improved function

Aug 1, 2002, 8:38pm
I created a function for coming up with parameters of stuff (well you'll see
since I can't really explain it) but it is definitely OBSOLETE. This would
be a lot easier with C++, but I use VB so oh well ^_^

[VB SDK] Much needed to be improved function

Aug 1, 2002, 8:51pm
Oops, forgot some stuff! Good luck trying to decipher the function, I can
barely understand it myself. I am not a very efficient programmer (as you
will see) but the function does work, it is just very slow. Here is an
example of what it does.
Dim colPars as New Collection
Set colPars = GetParameters("goto Atlantis, 0n 0w", "^goto *, *")
Debug.Print colPars(1)
Debug.Print colPars(2)
This would display Atlantis and 0n 0w in the Immediate log thingy. The ^ is
there because it tells the function to read from the beginning of the
strMain instead of looking from anywhere, for example:
Dim colPars as New Collection
Set colPars = GetParameters("lalalala goto Atlantis, 0n 0w", "goto *, *")
Debug.Print colPars(1)
Debug.Print colPars(2)
That would display the same as the above function. I made it for a MUD
client I was working on. Anyway, It seems to be pretty slow, so maybe
someone can help correct it or tell me a better function (good luck looking
at mine!) Here it is:

Public Function GetParameters(ByVal strMain As String, ByVal szFormat As
String, Optional CaseSensitive As Boolean = True, Optional DoTrim As Boolean
= False) As Collection
On Error Resume Next
Dim Args1 As New Collection
Dim i As Integer
Dim Letter As String
Dim Args2 As Collection
Dim strTemp As String
Dim buffer1 As String
Dim buffer2 As String
Dim strLeft As String
Dim ToGoTo As Integer
Dim DoAtEnd As Boolean
Dim MustLine As Boolean
Dim SoFar As String
Dim boolHadWS As Boolean
Dim WhiteSpace As New Collection
Dim TrimL As New Collection
Dim TrimR As New Collection
If Strings.Left(szFormat, 1) = "*" Then szFormat = "^" & szFormat
strLeft = " " & strMain & " "
szFormat = VBA.Replace(szFormat, "\*", " at at (S)")
szFormat = VBA.Replace(szFormat, "\^", " at at (U)")
'szFormat = VBA.Replace(szFormat, "\&", " at at (AND)")
szFormat = VBA.Replace(szFormat, "\#", " at at (NUM)")
szFormat = VBA.Replace(szFormat, "\~", " at at (WS)")
If InStr(szFormat, "~*") Or InStr(szFormat, "*~") Then
Err.Raise 55103, , "Whitespace characters cannot appear next to *'s
as this does not fit their conversion process."
Exit Function
End If
If CountSubstring(szFormat, "~") > 20 Then
Err.Raise 51502, , "Too many whitespace characters (~)! Limit is 20,
0 is not counted."
Exit Function
End If
If CountSubstring(szFormat, "~") > 0 Then
Dim buff1 As String
Dim buff2 As String
Dim p As Integer
Dim buffleft As String
Dim thing As String
thing = "~"
buffleft = szFormat
buffleft = Replace(buffleft, "*~", " at at (ASTWS)")
buffleft = Replace(buffleft, "~*", " at at (WSAST)")
NumP3:
If VBA.InStr(buffleft, "~") Then
p = InStr(buffleft, "~")
buff1 = VBA.Left(buffleft, VBA.InStr(buffleft, "~") - 1)
WhiteSpace.Add CountSubstring(buff1, "*") + 1
buff2 = VBA.Right(buffleft, Len(buffleft) - Len(buff1) - 1)
buffleft = buff1 & "*" & buff2
End If
If VBA.InStr(buffleft, "~") Then GoTo NumP3
buffleft = Replace(buffleft, " at at (ASTWS)", "*~")
buffleft = Replace(buffleft, " at at (WSAST)", "~*")
szFormat = buffleft
End If
If VBA.Left(szFormat, 1) = "^" Then szFormat = VBA.Right(szFormat,
Len(szFormat) - 1): MustLine = True
If MustLine = False Then
szFormat = "*" & szFormat
End If
If CountSubstring(szFormat, "*") - WhiteSpace.Count > 19 And MustLine =
True Then
Err.Raise 51502, , "Too many *'s! Limit is 9, 0 can't be used."
Exit Function
End If
If CountSubstring(szFormat, "*") - WhiteSpace.Count > 20 And MustLine =
False Then
Err.Raise 51502, , "Too many *'s! Limit is 9, 0 is not counted."
Exit Function
End If
szFormat = VBA.Replace(szFormat, "\^", " at at (U)")
strLeft = VBA.Replace(strLeft, "*", " at at (S)")
strLeft = VBA.Replace(strLeft, "^", " at at (U)")
If VBA.Left(szFormat, 1) = "^" Then szFormat = VBA.Right(szFormat,
Len(szFormat) - 1): MustLine = True
szFormat = " " & szFormat & " "
Set Args2 = GetArgs(szFormat, "*")
If CaseSensitive = True And InStr(szFormat, "*") = False Then GoTo TheOk
If CaseSensitive = True And Lin(strLeft, Args2(1)) = False Then GoTo
ThePlace
If CaseSensitive = False And Lin(LCase(strLeft), LCase(Args2(1))) =
False Then GoTo ThePlace
If CaseSensitive = True And strLeft = szFormat Then GoTo TheOk
If CaseSensitive = False And LCase(strLeft) = LCase(szFormat) Then GoTo
TheOk
Dim Compare1 As String
Dim Compare2 As String
If VBA.Right(szFormat, 1) <> "*" Then ToGoTo = Args2.Count
For i = 1 To ToGoTo
If i < ToGoTo Then
If CaseSensitive = True Then _
strTemp = VBA.Mid(strLeft, InStr(strLeft, Args2(i)) + _
Len(Args2(i)), Len(strLeft) - InStr(strLeft, Args2(i)) +
_
Len(Args2(i))) _
Else _
strTemp = VBA.Mid(strLeft, InStr(LCase(strLeft),
LCase(Args2(i))) + _
Len(Args2(i)), Len(strLeft) - InStr(LCase(strLeft) _
, LCase(Args2(i))) + Len(Args2(i)))
If CaseSensitive = True Then _
buffer1 = VBA.Left(strLeft, _
InStr(strLeft, Args2(i)) + Len(Args2(i))) _
Else _
buffer1 = VBA.Left(strLeft, InStr(LCase(strLeft), _
LCase(Args2(i))) + Len(Args2(i)))
strLeft = VBA.Right(strLeft, Len(strLeft) - Len(buffer1) + 1)
If Lin(strLeft, strTemp) = False And i > 1 Then GoTo ThePlace
If CaseSensitive = True Then _
strTemp = VBA.Left(strTemp, InStr(strTemp, Args2(i + 1)) -
1) _
Else strTemp = VBA.Left(strTemp _
, InStr(LCase(strTemp), LCase(Args2(i + 1))) - 1)
strTemp = VBA.Replace(strTemp, " at at (S)", "*")
strTemp = VBA.Replace(strTemp, " at at (U)", "^")
strTemp = VBA.Replace(strTemp, " at at (NUM)", "#")
strTemp = VBA.Replace(strTemp, " at at (WS)", "~")
If DoTrim = False Then Args1.Add strTemp Else Args1.Add
Trim(strTemp)
SoFar = SoFar & Args2(i) & strTemp
'Else
End If
Next i
If DoAtEnd = True Then
Args1.Add strLeft
SoFar = SoFar & Args2(Args2.Count) & strLeft
Else
SoFar = SoFar & Args2(Args2.Count)
End If
SoFar = VBA.Left(SoFar, Len(SoFar) - 2)
SoFar = VBA.Right(SoFar, Len(SoFar) - 1)
ThePlace:
LastActual = SoFar
If CaseSensitive = True Then
If SoFar <> strMain Then Err.Raise 51501, , "Values aren't alike: "
& Chr(34) & strMain & Chr(34) & " vs. " & Chr(34) & SoFar & Chr(34): Exit
Function
Else
If LCase(SoFar) <> LCase(strMain) Then Err.Raise 51501, , "Values
aren't alike: " & LCase(strMain) & "vs. " & LCase(SoFar): Exit Function
End If
TheOk:
If MustLine = False Then Args1.Remove 1
If WhiteSpace.Count > 0 Then
Dim l As Integer
Dim l1 As Integer
Dim strbuff As String
Dim num1 As Integer
':S don't ask!
For l = 1 To WhiteSpace.Count
strbuff = Args1(WhiteSpace(l) - num1)
If strbuff = Space(Len(strbuff)) Then
Args1.Remove (WhiteSpace(l) - num1)
num1 = num1 + 1
Else
Exit Function
End If
Next l
End If
Set GetParameters = Args1
End Function

[View Quote]

[VB SDK] Much needed to be improved function

Aug 1, 2002, 8:55pm
Oh and here's the CountSubstring function:
Public Function CountSubstring(ByVal strInput As String, ByVal strFind As
String) As Long
CountSubstring = (Len(strInput) - Len(Replace(strInput, strFind, ""))) /
Len(strFind)
End Function


[View Quote]

[VB SDK] Much needed to be improved function

Aug 6, 2002, 1:08am
umm cos when I made it I didn't know about split? But thanks for the tip, I
may rewrite the function soon

[View Quote]

[VB SDK] Much needed to be improved function

Aug 6, 2002, 4:03am
Thanks to Strike, I have revised my function and have created a debug
function to show statistics. It turns out that it takes longer for the old
function to process when the strings aren't alike than it does for the old
function to process when it returns a group and they are a like! (This is
crazy so go oh my god in your head whether you understand it or not). Each
of these were tested with Set colpars = GetParameters("goto AW, 10N 15W",
"goto *,*")

Results for strings alike (return collection):
The new method took 0.2969 seconds. The old method took 0.5312 seconds.
Difference: 0.234375. Test results from 2000 tests.

Results for strings not alike (no return collection, which SHOULD be quicker
but wasn't on the old function):
The new method took 0.0938 seconds. The old method took 2.6328 seconds.
Difference: 2.539063. Test results from 2000 tests.

Believe it or not, this is a very useful function that I have been searching
for for a very long time. I couldn't find it so I had to make one :( .
Contact homeworkkid at msn.com (me of course) if you find any bugs or want to
know how to use it (though I will explain below).
Say you wanted to make a function for a bot. You would do something like
this:

Dim colPars as new Collection
Set colPars = GetParameters(TheMessage, "whisper *,*")
If colpars.Count > 0 Then
sdk1.Aw_Whisper AwUsers(colpars(1)), colpars(2)
Goto Bottom
end if

This command would, if the user used the command, whisper a message to a
specific user (considering your user classes work the same way).

Well, now you see how inefficient the old function was and have learned how
to use the GetParameters function. Here is the new one and its supporting
functions that I have made to make the coding easier for me :) :

Public Function GetParameters(strMain As String, ByVal szFormat As String,
Optional CaseSensitive As Boolean = False, Optional DoTrim As Boolean =
True) As Collection
On Error Resume Next
Dim pars() As String
Dim retpars As New Collection
Dim strTemp As String
Dim strLeft As String
Dim i As Integer
Dim t1 As Integer 'for InStr functions
Dim t2 As Integer 'for InStr functions
strLeft = strMain
If szFormat = "*" Then retpars.Add strMain: Set GetParameters = retpars:
Exit Function
''The below involves \ before ^, *, etc.
strLeft = Replace(strLeft, " at ", " at at ( at )")
strLeft = Replace(strLeft, "\", " at at (S)")
strLeft = Replace(strLeft, "*", " at at (A)")
strLeft = Replace(strLeft, "^", " at at (E)")
szFormat = Replace(szFormat, " at ", " at at ( at )")
szFormat = Replace(szFormat, "\\", " at at (S)")
szFormat = Replace(szFormat, "\*", " at at (A)")
szFormat = Replace(szFormat, "\^", " at at (E)")
'
pars = Split(szFormat, "*")
If Strings.Left(szFormat, 1) = "^" Then
szFormat = Strings.Right(szFormat, Len(szFormat) - 1)
pars(0) = Right(pars(0), Len(pars(0)) - 1)
If Strings.Left(strLeft, Len(pars(i))) <> pars(0) Then Exit Function
End If
For i = 0 To UBound(pars)
If CaseSensitive = True Then t1 = InStrEnd(strLeft, pars(i)) Else t1
= InStrEnd(LCase(strLeft), LCase(pars(i)))
If t1 = 0 Then Exit Function
If CaseSensitive = True Then t2 = InStr(ToEnd(strLeft, t1), pars(i +
1)) + t1 Else t2 = InStr(LCase(ToEnd(strLeft, t1)), LCase(pars(i + 1))) + t1
If t2 = 0 Then Exit Function
strTemp = PosToPos(strLeft, t1, t2)
'The below involves \ before ^, *, etc.
strTemp = Replace(strTemp, " at at (E)", "^")
strTemp = Replace(strTemp, " at at (A)", "*")
strTemp = Replace(strTemp, " at at (S)", "\")
strTemp = Replace(strTemp, " at at ( at )", " at ")
'
If DoTrim = False Then retpars.Add strTemp Else retpars.Add
Trim(strTemp)
strLeft = ToEnd(strLeft, t1)
Next i
'There seemed to be a problem if the last character of an szFormat
'was * so it was fixed below.
If Strings.Right(szFormat, 1) = "*" Then
Dim toadd As String
toadd = retpars(retpars.Count - 1) & retpars(retpars.Count)
retpars.Remove retpars.Count
retpars.Remove retpars.Count
'The below involves \ before ^, *, etc.
toadd = Replace(toadd, " at at (E)", "^")
toadd = Replace(toadd, " at at (A)", "*")
toadd = Replace(toadd, " at at (S)", "\")
toadd = Replace(toadd, " at at ( at )", " at ")
'
If DoTrim = False Then retpars.Add toadd Else retpars.Add
Trim(toadd)
Else
retpars.Remove retpars.Count
End If
Set GetParameters = retpars
End Function

Public Function InStrEnd(Start As String, String1 As String) As Integer
InStrEnd = InStr(Start, String1)
If InStrEnd <> 0 Then InStrEnd = InStrEnd + Len(String1)
End Function

Public Function ToEnd(strMain As String, Pos1 As Integer) As String
ToEnd = Strings.Right(strMain, Len(strMain) - Pos1)
End Function

Public Function PosToPos(strMain As String, Pos1 As Integer, Pos2 As
Integer) As String
PosToPos = Mid(strMain, Pos1, Pos2 - Pos1)
End Function

[View Quote]

[VB SDK] Much needed to be improved function

Aug 7, 2002, 6:31pm
:) Thank you, this function will help for my many small command checks.

The old method took 0.4141 seconds. The new method took 0.0469 seconds.
Difference: 0.3671875. Test results from 2000 tests.

As you can see, Strike's method is much faster in this area (the new
method).

[View Quote]

[VB SDK] Much needed to be improved function

Aug 9, 2002, 5:00am
well, the new function i recently posted doesnt fully work, so i give up and
im learning C++ now :)

[View Quote]

[C++ SDK] awsdk1.cpp(171) : error C2065: 'aw_console_messsage' : undeclared identifier

Aug 9, 2002, 4:09am
It says unideclared identifier! Here's the code:

#define AW_STATIC

#include "aw.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>

void handle_avatar_add (void);
void handle_chat (void);
void leftcopy(char* input,char* output,int pos);
void rightcopy(char* input,char* output,int pos);
void midcopy(char* input,char* output,int start_pos, int stop_pos);
int findstr(char* body,char* search);
void lcase(char* buffer);
void ucase(char* buffer);
void* bot1;
void* bot2;


main (int argc, char *argv[])
{

int rc;

/* check command line */
if (argc < 3) {
printf ("Usage: %s number password\n", argv[0]);
exit (1);
}
/* initialize Active Worlds API */
if (rc = aw_init (AW_BUILD)) {
printf ("Unable to initialize API (reason %d)\n", rc);
exit (1);
}

/* install handler for avatar_add event */
aw_event_set (AW_EVENT_AVATAR_ADD, handle_avatar_add);
aw_event_set (AW_EVENT_CHAT, handle_chat);

/* create bot instance */
if (rc = aw_create (0, 0, &bot1)) {
printf ("Unable to create bot instance 1 (reason %d)\n", rc);
exit (1);
}
if (rc = aw_create (0, 0, &bot2)) {
printf ("Unable to create bot instance 2 (reason %d)\n", rc);
exit (1);
}
printf("Logging bots in..\n");
/* log bot into the universe */
aw_instance_set(bot1);
aw_int_set (AW_LOGIN_OWNER, atoi (argv[1]));
aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, argv[2]);
aw_string_set (AW_LOGIN_APPLICATION, "SDK Sample Application #1");
aw_string_set (AW_LOGIN_NAME, "TransferBot1");
if (rc = aw_login ()) {
printf ("Unable to login bot 1 (reason %d)\n", rc);
exit (1);
}

aw_instance_set(bot2);
aw_int_set (AW_LOGIN_OWNER, atoi (argv[1]));
aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, argv[2]);
aw_string_set (AW_LOGIN_APPLICATION, "SDK Sample Application #2");
aw_string_set (AW_LOGIN_NAME, "TransferBot2");
if (rc = aw_login ()) {
printf ("Unable to login bot 2 (reason %d)\n", rc);
exit (1);
}
/* log bot into the world called "beta" */
printf("Traveling to worlds..\n");
aw_instance_set(bot1);
if (rc = aw_enter ("tomilius")) {
printf ("Bot 1 Unable to enter world (reason %d)\n", rc);
exit (1);
}

aw_instance_set(bot2);
if (rc = aw_enter ("AWTeen")) {
printf ("Bot 2 Unable to enter world (reason %d)\n", rc);
exit (1);
}
printf("Going to coordinates...\n");
aw_instance_set(bot1);
/* announce our position in the world */
//aw_int_set (AW_MY_X, -8000); /* 8E */
aw_int_set (AW_MY_X,1000);
//aw_int_set (AW_MY_Z, -37000); /* 37S */
aw_int_set (AW_MY_Z,1000);
aw_int_set (AW_MY_YAW, 2250); /* face towards GZ */
if (rc = aw_state_change ()) {
printf ("Bot 1 Unable to change state (reason %d)\n", rc);
exit (1);
}

aw_instance_set(bot2);
/* announce our position in the world */
aw_int_set (AW_MY_X, 2866110); /* 2866.11W */
aw_int_set (AW_MY_Y, -32300); /* -323A */
aw_int_set (AW_MY_Z, 2618900); /* 2618.90N */
aw_int_set (AW_MY_YAW, 2250); /* face towards GZ */
if (rc = aw_state_change ()) {
printf ("Bot 2 Unable to change state (reason %d)\n", rc);
exit (1);
}
printf("Logged in and traveled to coordinates!\n");
printf("Bot 1 has number %d\n",bot1);
printf("Bot 2 has number %d\n",bot2);
/* main event loop */
do
{
aw_instance_set(bot1);
aw_instance_set(bot2);
}
while (!aw_wait (-1))
;

/* close everything down */
aw_destroy ();
aw_term ();
return 0;

}

void handle_avatar_add (void)
{

char message[100];

sprintf (message, "Hello %s.", aw_string (AW_AVATAR_NAME));
aw_whisper(aw_int(AW_AVATAR_SESSION),message);
// log the event to the console
printf ("avatar_add: %s\n", aw_string (AW_AVATAR_NAME));

}

void handle_chat (void)
{
char *chatmessage;
char message[256];
char *name;
/*char message[100];
if (aw_int(AW_CHAT_TYPE) == AW_CHAT_WHISPER )
{
if(!strcmp(aw_string(AW_AVATAR_NAME),"Tomilius"))
{
aw_say(aw_string(AW_CHAT_MESSAGE));
}
else
{
sprintf (message, "I'm sorry %s, Tomilius doesn't want you making me
talk.",aw_string (AW_AVATAR_NAME));
aw_whisper(aw_int (AW_AVATAR_SESSION), message);
}
}*/
if (aw_int(AW_CHAT_TYPE) != AW_CHAT_WHISPER)
{
name = aw_string(AW_AVATAR_NAME);
chatmessage = aw_string(AW_CHAT_MESSAGE);
printf("Got message from %d - %s: %s\n",aw_instance(),name,chatmessage);
if (aw_instance() == bot1)
{
printf("Set instance to %d to send.\n",bot2);
aw_instance_set(bot2);
sprintf(message, "%s: %s",name,chatmessage);
aw_string_set(AW_CONSOLE_MESSAGE,message);
aw_int_set(AW_CONSOLE_BLUE,100);
aw_int_set(AW_CONSOLE_RED,0);
aw_int_set(AW_CONSOLE_GREEN,0);
aw_bool_set(AW_CONSOLE_ITALICS,false);
aw_bool_set(AW_CONSOLE_BOLD,true);
aw_console_messsage (0);
}
else
{
printf("Set instance to %d to send.\n",bot1);
aw_instance_set(bot1);
sprintf(message, "%s: %s", name, chatmessage);
aw_say(message);
}
}
}

// left copy
void leftcopy(char* input,char* output,int pos)
{
int index = 0;
for(int i = 0; i < pos; i++)
{
output[index] = input[i];
index++;
}
output[index] = 0;
}
// right copy
void rightcopy(char* input,char* output,int pos)
{
int index = 0;
int len = strlen(input);
for(int i = pos; i < len; i++)
{
output[index] = input[i];
index++;
}
output[index] = 0;

}
void midcopy(char* input,char* output,int start_pos, int stop_pos)
{
int index = 0;
for(int i = start_pos; i < stop_pos; i++)
{
output[index] = input[i];
index++;
}

output[index] = 0;
}
int findstr(char* body,char* search)
{
int len = strlen(body);
int len2 = strlen(search); // search len

for(int i = 0; i < len; i++)
{
if(body[i] == search[0])
{
bool ichk = true;

for(int z = 0; z < len2; z++)
{
if(body[i+z] == search[z])
{
}
else
{
ichk = false;
}
}

if(ichk == true)
{
return i;
}
}
}

return -1; // failure
}
// lower case
void lcase(char* buffer)
{
int len = strlen(buffer);

for(int i = 0; i < len; i++)
{
buffer[i] = tolower(buffer[i]);
}
}
// upercase
void ucase(char* buffer)
{
int len = strlen(buffer);

for(int i = 0; i < len; i++)
{
buffer[i] = toupper(buffer[i]);
}
}

[C++ SDK] awsdk1.cpp(171) : error C2065: 'aw_console_messsage' : undeclared identifier

Aug 9, 2002, 4:46am
Okay, God Zedle said he needed the whole code or else he couldn't help, but
here's the main section.

if (aw_int(AW_CHAT_TYPE) != AW_CHAT_WHISPER)
{
name = aw_string(AW_AVATAR_NAME);
chatmessage = aw_string(AW_CHAT_MESSAGE);
printf("Got message from %d - %s: %s\n",aw_instance(),name,chatmessage);
if (aw_instance() == bot1)
{
printf("Set instance to %d to send.\n",bot2);
aw_instance_set(bot2);
sprintf(message, "%s: %s",name,chatmessage);
aw_string_set(AW_CONSOLE_MESSAGE,message);
aw_int_set(AW_CONSOLE_BLUE,100);
aw_int_set(AW_CONSOLE_RED,0);
aw_int_set(AW_CONSOLE_GREEN,0);
aw_bool_set(AW_CONSOLE_ITALICS,false);
aw_bool_set(AW_CONSOLE_BOLD,true);
aw_console_messsage (0);
}
else
{
printf("Set instance to %d to send.\n",bot1);
aw_instance_set(bot1);
sprintf(message, "%s: %s", name, chatmessage);
aw_say(message);
}
}

[View Quote]

[C++ SDK] awsdk1.cpp(171) : error C2065: 'aw_console_messsage' : undeclared identifier

Aug 9, 2002, 5:04am
oh and here's the line:
aw_console_messsage (0);
lol

[View Quote]

[C++ SDK] awsdk1.cpp(171) : error C2065: 'aw_console_messsage' : undeclared identifier

Aug 9, 2002, 5:41am
OOOOOOOOOH!! Wow! Nobody has noticed that yet! Thanks, thought it was
something simple :)
[View Quote]

New to C++, how to make it work with an interface?

Aug 9, 2002, 7:43pm
I'm sorta new to C++, and I know how to do that MFC AppWizard and all of
that, but I try putting #define AW_STATIC at the top of the dialog code and
#include "aw.h" below it with those files in the project's directory and
everything and it says everything is undeclared. Maybe someone can help? (no
I didn't spell them wrong this time lol i copied them directly from the
console version).

terrain textures problem

Jul 28, 2002, 11:01pm
You'd be surprised how difficult everything seems to be to fix

[View Quote]

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