• Welcome to Valhalla Legends Archive.
 

A tricky problem...

Started by Atom, February 12, 2003, 01:34 PM

Previous topic - Next topic

Atom

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!  ::) ::) ::)
I am back! aINC is dead, ThinkTank PRO is alive.
VB, JAVA, ASM, C, its all yummy to me.

Banana fanna fo fanna

#1
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

Atom

#2
Once again i feel like a complete and utter moron. Thank you Storm.id!

frmmain.scripting.reset

Thats all i needed!
I am back! aINC is dead, ThinkTank PRO is alive.
VB, JAVA, ASM, C, its all yummy to me.