Thread

-=- Erm, Help... -=- (Sdk)

-=- Erm, Help... -=- // Sdk

1  |  

tony56

Dec 29, 2000, 8:51am
I'm using the Delphi AwAPI, and I am trying my hand at getting the
universe world list.

Well, this procedure gives me errors. Here's code paste.
-----------------------------------------------------------
// AwSDK -- World list
procedure AwWorldInfo;
var
WName: String;
WStat: Integer;
WUsers: Integer;
begin
WName := aw_string(AW_WORLDLIST_NAME);
WStat := aw_int(AW_WORLDLIST_STATUS);
WUsers := aw_int(AW_WORLDLIST_USERS);
if WStat = AW_WORLDSTATUS_PUBLIC then WName := '[Pu] ' + WName;
if WStat = AW_WORLDSTATUS_PRIVATE then WName := '[Pr] ' + WName;
if WStat = AW_WORLDSTATUS_UNKNOWN then WName := '[??] ' + WName;
Form8.TreeView.Items.Add(nil, WName);
Form8.ListBox.Items.Add(aw_string(AW_WORLDLIST_NAME) + ': ' +
IntToStr(WUsers) + ' users');
end;
-----------------------------------------------------------
Now, according to Delphi the error is in the three 'if' statements.
Error messages pasted below.
-----------------------------------------------------------
[Error] Unit2.pas(338): Incompatible types
[Error] Unit2.pas(339): Incompatible types
[Error] Unit2.pas(340): Incompatible types
-----------------------------------------------------------

What do I do?

--
- Tony56 (chandler56 at mail.com)
"Freedom: That's What The Government Wants You To Believe!"
____________________________________________________________

canopus

Dec 29, 2000, 3:47pm
Maybe the error is in WName:

WName := aw_string(AW_WORLDLIST_NAME);

An aw_string is a C-string; you should always convert this to a Delphi string:

WName := string(aw_string(AW_WORLDLIST_NAME));

Then it can be used in any Delphi string operation, like concatenation:

WName := '[Pu] ' + WName;

[View Quote] > I'm using the Delphi AwAPI, and I am trying my hand at getting the
> universe world list.
>
> Well, this procedure gives me errors. Here's code paste.
> -----------------------------------------------------------
> // AwSDK -- World list
> procedure AwWorldInfo;
> var
> WName: String;
> WStat: Integer;
> WUsers: Integer;
> begin
> WName := aw_string(AW_WORLDLIST_NAME);
> WStat := aw_int(AW_WORLDLIST_STATUS);
> WUsers := aw_int(AW_WORLDLIST_USERS);
> if WStat = AW_WORLDSTATUS_PUBLIC then WName := '[Pu] ' + WName;
> if WStat = AW_WORLDSTATUS_PRIVATE then WName := '[Pr] ' + WName;
> if WStat = AW_WORLDSTATUS_UNKNOWN then WName := '[??] ' + WName;
> Form8.TreeView.Items.Add(nil, WName);
> Form8.ListBox.Items.Add(aw_string(AW_WORLDLIST_NAME) + ': ' +
> IntToStr(WUsers) + ' users');
> end;
> -----------------------------------------------------------
> Now, according to Delphi the error is in the three 'if' statements.
> Error messages pasted below.
> -----------------------------------------------------------
> [Error] Unit2.pas(338): Incompatible types
> [Error] Unit2.pas(339): Incompatible types
> [Error] Unit2.pas(340): Incompatible types
> -----------------------------------------------------------
>
> What do I do?
>
> --
> - Tony56 (chandler56 at mail.com)
> "Freedom: That's What The Government Wants You To Believe!"
> ____________________________________________________________
>
>

tony56

Dec 29, 2000, 5:33pm
No, I am still getting the same three errors in the 'if' statements.

--
- Tony56 (chandler56 at mail.com)
"Freedom: That's What The Government Wants You To Believe!"
____________________________________________________________
[View Quote]

canopus

Dec 29, 2000, 6:58pm
Try making sure that the Boolean expression is the one intended:

if (WStat = AW_WORLDSTATUS_PUBLIC)
If that doesn't help, set a breakpoint & use a debug window to examine
the local variables & see what's going on there.

[View Quote] > No, I am still getting the same three errors in the 'if' statements.
>
> --
> - Tony56 (chandler56 at mail.com)
> "Freedom: That's What The Government Wants You To Believe!"
> ____________________________________________________________
[View Quote]

canopus

Dec 29, 2000, 7:08pm
You could also be having problems because of the way that Delphi
converts C strings to Delphi strings, in particular because you tried to
concatenate to the converted string. Try specifically allocating a long
Delphi string to WName before you do any concatenation to it:
SetLength(WName, 260);

[View Quote] > Try making sure that the Boolean expression is the one intended:
>
> if (WStat = AW_WORLDSTATUS_PUBLIC)
> If that doesn't help, set a breakpoint & use a debug window to examine
> the local variables & see what's going on there.
>
[View Quote]

tony56

Dec 29, 2000, 7:43pm
I figured it out.. i needed to have AW_WORLDSTATUS_<blarg> as an
integer, so i just put Integer(AW_WORLDSTATUS_PRIVATE) and so on. Works
fine now :)

--
- Tony56 (chandler56 at mail.com)
"Freedom: That's What The Government Wants You To Believe!"
____________________________________________________________
[View Quote]

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