Thread

SDK C++ buggers... (Sdk)

SDK C++ buggers... // Sdk

1  |  

veleno

Nov 14, 1999, 2:26pm
Got a problem... it's probably not hard to fix, i'm just missing
something...

making a GUI SDK bot... and can't get the chat message from the void
chat() function back to the C++ side of it to print to the chat
window... anyone understand?
I'll post some example code to try to illustrate my problem...

//preprocessing...
void chat(void);
CString Message;
....
CSDKDlg::OnLogin( ){
.... //login junk...
aw_event_set(AW_EVENT_CHAT, chat);
..../rest of login junk...
(btw, the Chat Window variable in the dialog box is 'CString Login')
}

void chat(void) {
Message = aw_string(AW_AVATAR_NAME) + ": ";
Message += aw_string(AW_CHAT_MESSAGE) + "\r\n";
}

now, up to this point, it works all fine... but how do I send the
Message BACK into the CString Login so it will refresh on the chat
window???
any takers? Ask if you need more code posted... I'm not sure if this
makes it clear enough...

Veleno
Co-Owner of "damascus"
297593

edward

Nov 14, 1999, 8:35pm
You need to think about the OO model you are using. Think about the bot
objects and the Window objects as being separate, which I guess you are
doing now because that is your problem. Then define the interface
between the two.

For example, lets say you have a bot that has botsay and botchat
methods. You also have a gui class that has a showchat and an entersay
method.

Each object will have to pass information to the other object. The bot
must pass chat text to the window and the window must pass say text to
the bot.

class Bot
botchat {
window. showchat(message);
}
botsay (char message) {
aw_say(message);
}
}

class window
showchat(message) {
Login = message;
refresh windows;
}
entersay {
bot.botsay(Login);
}
}

The only other thing you have to do is let the bot know which window
object it is interfacing with and then tell the window which bot it is
interfacing with.

main {

Bot b = new Bot();
Window w = new Window();

b.setWindow( w );
w.setBot( b );
}

This is a simple design pattern and can be extended depending on the
flexability that you need.

[View Quote] > Got a problem... it's probably not hard to fix, i'm just missing
> something...
>
> making a GUI SDK bot... and can't get the chat message from the void
> chat() function back to the C++ side of it to print to the chat
> window... anyone understand?
> I'll post some example code to try to illustrate my problem...
>
> //preprocessing...
> void chat(void);
> CString Message;
> ...
> CSDKDlg::OnLogin( ){
> ... //login junk...
> aw_event_set(AW_EVENT_CHAT, chat);
> .../rest of login junk...
> (btw, the Chat Window variable in the dialog box is 'CString Login')
> }
>
> void chat(void) {
> Message = aw_string(AW_AVATAR_NAME) + ": ";
> Message += aw_string(AW_CHAT_MESSAGE) + "\r\n";
> }
>
> now, up to this point, it works all fine... but how do I send the
> Message BACK into the CString Login so it will refresh on the chat
> window???
> any takers? Ask if you need more code posted... I'm not sure if this
> makes it clear enough...
>
> Veleno
> Co-Owner of "damascus"
> 297593

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