Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Atom on February 12, 2003, 01:34 PM

Title: A tricky problem...
Post by: Atom on February 12, 2003, 01:34 PM
I load all of my VbScript into the MsScript control on startup. I have it so you can edit the code from my bot's control panel... but i have no way to add the code after its edited.

There is no clearcode function on the control... there is no way to get rid of the old code!

Im thinking of unloading the control, but im not quite sure how i could reload after i do so... so maybe somebody can come up with a quick fix?

Tested Code, PLZ!  ::) ::) ::)
Title: Re: A tricky problem...
Post by: Banana fanna fo fanna on February 12, 2003, 02:04 PM
Make the changes to the script file and call this.

Public Sub LoadScript()
    On Error Resume Next 'ignore when someone connects multiple times or deletes their script
    Dim f As Long
    Dim tmp As String
    Dim final As String
    
    If ScriptFile = "" Then Exit Sub
    
    frmTimers.ClearTimers
    
    frmMain.Scripting.Reset
    frmMain.Scripting.language = ScriptLanguage
    frmMain.Scripting.AddObject "Bot", Bot
    
    f = FreeFile
    Open App.path & "\" & ScriptFile For Input As #f
    
    Do While Not EOF(f)
        Line Input #f, tmp
        final = final & tmp & vbNewLine
    Loop
    
    Close #f
    
    frmMain.Scripting.AddCode final
End Sub
Title: Re: A tricky problem...
Post by: Atom on February 12, 2003, 02:24 PM
Once again i feel like a complete and utter moron. Thank you Storm.id!

frmmain.scripting.reset

Thats all i needed!