ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Question... (Bots)
Question... // BotszeofatexJun 23, 2003, 11:23am
Does anyone have a module that allows us to make consoling easier? Example:
Instead of sdk.AwConsoleMessage = "Blah" sdk.AwConsoleRed = 3 sdk.AwConsoleGreen = 1 sdk.AwConsoleBlue = 2 sdk.AwConsoleItalics = False sdk.AwConsoleBold = True sdk.AwConsoleMsg sdk.AwChatSession End If There is Console("Blah",3,1,2,False,True,sdk.AwChatSession) I'm not exactly sure how to do this since I don't normally build modules... Don't flame me for not using the dll, I was giving a quick example that I didn't have to write 20 things out for. I use the dll when I'm not feeling lazy ;) Thanks in advance, Zeo P.S. I'll be posting this in SDK also as it's an SDK related question. strike rapierJun 23, 2003, 4:52pm
Not only modules, you clearly dont have a clue what the hell your doing with
basic VB syntax.... What I say to everyone (I learnt this the hard way after many a telling off from Baron) Learn the basic VB first! If you cant make a bloody console message function its time to give up, go home... sleep for a year then pick up a VB book and learn in the right order. - Mark [View Quote] zeofatexJun 24, 2003, 11:25am
Thank you Mark, that was exactly the answer I was looking for! That helped
me build a wonderful module. Anyone else want to flame me? BTW: I passed the Computer Science final (i.e. Visual Basic) with a higher grade than everyone else -- and I did not take the class. I got such a high grade I was allowed to skip to C++ Honors. Keep talking, I do have 3 books here that I was referencing. Visual Quickstart, The Idiot's Guide, and VB for Dummies (like me). I expect answers, not flames. Once again, can someone please tell me how to make a module for consoling? -Zeo [View Quote] binarybudJun 24, 2003, 1:49pm
:)
I think you want a FORM thats invisible along with using the "Command$" command.....to read commandline arguments... strArgs = Split(Command$, " ") HTH Leo :) [View Quote] dm mercuryJun 24, 2003, 2:23pm
===============================
awsdkocx5 =============================== Function ConsoleMsg (Red as Integer, Green as Integer, Blue as Integer, Bold as Boolean, Italic as Boolean, Session as Long, Message as String) sdk.AwConsoleRed = Red sdk.AwConsoleGreen = Green sdk.AwConsoleBlue = Blue sdk.AwConsoleBold = Bold sdk.AwConsoleItalic = Italic sdk.AwConsoleMessage = Message sdk.AwConsoleMessage Session End Function ================================ com wrapper ================================ Function ConsoleMsg(Red as Integer, Green as Integer, Blue as Integer, Bold as Boolean, Italic as Boolean, Session as Long, Message as String) sdk.aw_int_set AW_CONSOLE_RED, Red sdk.aw_int_set AW_CONSOLE_GREEN, Green sdk.aw_int_set AW_CONSOLE_BLUE, Blue sdk.aw_bool_set AW_CONSOLE_BOLD, Bold sdk.aw_bool_set AW_CONSOLE_ITALICS, Italic sdk.aw_string_set AW_CONSOLE_MESSAGE, Message sdk.aw_console_msg Session End Function ================================ Useage Example: ConsoleMsg 139,10,64,True,False, avSession, "Weclome to my world!" Niether of these functions are tweaked to handle longer messages. If you want to send the message to the entire world make sure the Session value you send is 0. Hope this is what you are looking for, for which ever vb sdk that you use. DM [View Quote] binarybudJun 24, 2003, 2:44pm
baronJun 24, 2003, 2:50pm
In article <3ef6ff58$1 at server1.Activeworlds.com>, gzanone at optonline.net says...
> Does anyone have a module that allows us to make consoling easier? Example: > Instead of > > sdk.AwConsoleMessage = "Blah" > sdk.AwConsoleRed = 3 > sdk.AwConsoleGreen = 1 > sdk.AwConsoleBlue = 2 > sdk.AwConsoleItalics = False > sdk.AwConsoleBold = True > sdk.AwConsoleMsg sdk.AwChatSession > End If > > There is > > Console("Blah",3,1,2,False,True,sdk.AwChatSession) > > I'm not exactly sure how to do this since I don't normally build modules... > Don't flame me for not using the dll, I was giving a quick example that I > didn't have to write 20 things out for. I use the dll when I'm not feeling > lazy ;) > I don't really understand why you need a module for that, a function would do fine, use the function's return value to see if it failed (rc <>0); to return a meaningful message to the user you need to lookup the error code but that's another story. Perhaps I miss something in your post but... Private Function Console(msg As String, Red As Long, Green As Long, _ Blue As Long, Italics As Boolean, Bold As Boolean, _ Optional Session As Long) As Long sdk.AwConsoleMessage = msg sdk.AwConsoleRed = Red sdk.AwConsoleGreen = Green sdk.AwConsoleBlue = Blue sdk.AwConsoleItalics = Italics sdk.AwConsoleBold = Bold Console = sdk.AwConsoleMsg(Session) End Function Call the function as: Dim rc As Long 'leave session blank to send to all rc = Console("Blah", 3, 1, 2, False, True, sdk.AwChatSession) If rc Then Call MsgBox("Something went wrong (reason: " & rc & "), , "Ops!") End If Not sure if this works since I haven't used the ocx for ages. -- Baron zeofatexJun 24, 2003, 5:16pm
Thank you Merc and Baron, I was thinking it might be easier to use a module
instead of having to write the script over and over again in each new bot created heh. Even though it (the module) does waste some space, thought it would make life a bit easier. Thanks, -Zeo [View Quote] baronJun 24, 2003, 5:45pm
In article <3ef8a3a7$1 at server1.Activeworlds.com>, gzanone at optonline.net says...
> Thank you Merc and Baron, I was thinking it might be easier to use a module > instead of having to write the script over and over again in each new bot > created heh. Even though it (the module) does waste some space, thought it > would make life a bit easier. > Looks like you need to make your code reusable. You can make a module with your most used functions and subs, from the menu Project/Add module/New and paste your code there. Save the file and include it in your projects from the menu Project/Add module/Existing. Note that the module will not have access to private objects like sdk so you'll have to do something like: With frmMain 'or whatever you call the form containing the sdk instance .sdk.AwConsoleMessage = msg .sdk.AwConsoleRed = Red .sdk.AwConsoleGreen = Green .sdk.AwConsoleBlue = Blue .sdk.AwConsoleItalics = Italics .sdk.AwConsoleBold = Bold End With The module's functions and subs will have to be declared Public or if you want them private you'll have to access them as ModuleName.FunctionName -- Baron zeofatexJun 24, 2003, 8:20pm
Yessssss Thanks Baron!
-Zeo > Looks like you need to make your code reusable. You can make a module with your > most used functions and subs, from the menu Project/Add module/New and paste > your code there. Save the file and include it in your projects from the menu > Project/Add module/Existing. Note that the module will not have access to > private objects like sdk so you'll have to do something like: > > With frmMain 'or whatever you call the form containing the sdk instance > .sdk.AwConsoleMessage = msg > .sdk.AwConsoleRed = Red > .sdk.AwConsoleGreen = Green > .sdk.AwConsoleBlue = Blue > .sdk.AwConsoleItalics = Italics > .sdk.AwConsoleBold = Bold > End With > > The module's functions and subs will have to be declared Public or if you want > them private you'll have to access them as ModuleName.FunctionName > > -- > Baron strike rapierJun 25, 2003, 5:40pm
You.... passed.... Computer science.... not... knowing how the hell to use a
module and function? *Sigh* Thats worse standards than the bloody EDCL - Mark [View Quote] bowenJun 25, 2003, 5:44pm
|