Clear client values

Client~Side

modGeneral

At the end of the module add:


Public Sub ClearGameData()

    ' If debug mode, handle error then exit out

    If Options.Debug = 1 Then On Error GoTo errorhandler

    Call ClearNpcs

    Call ClearResources

    Call ClearItems

    Call ClearShops

    Call ClearSpells

    Call ClearAnimations

    ' Error handler

    Exit Sub

errorhandler:

    HandleError "ClearGameData", "modGeneral", Err.Number, Err.Description, Err.Source, Err.HelpContext

    Err.Clear

    Exit Sub

End Sub

Find:

    ' load the main game (and by extension, pre-load DD7)

Add to above:


    ' Clear game values

    Call SetStatus("Clearing game data...")

    Call ClearGameData

Credits

Ricardo

Isn’t this already being done?

Correct me if I am wrong, but aren’t variables initialized with value as null or 0 on startup by VB?

Isn’t this already being done?

Correct me if I am wrong, but aren’t variables initialized with value as null or 0 on startup by VB?

Yes, but when a string is declared thus:

     Name As String * 20

Visual Basic does not clean it 100%. So sometimes speaks of the npc is bugged.

Isn’t this already being done?

Correct me if I am wrong, but aren’t variables initialized with value as null or 0 on startup by VB?

And they may’ve just gone Game > Menu > Game. Thanks for posting, I’ll be sure to include this in 2.2.0 (if that’s okay).

And they may’ve just gone Game > Menu > Game.

This comment is found only in Main().


' load the main game (and by extension, pre-load DD7)

And I believe Main() is the first sub that VB runs. And it is not run again. So adding this will just increase start-up time. So all of this should be cleared say when frmMenu is unloaded or game loop execution ends or something. (But unless what iRicardo said is true, that VB doesn’t clear strings then this might be useful.)

This comment is found only in Main().


' load the main game (and by extension, pre-load DD7)

And I believe Main() is the first sub that VB runs. And it is not run again. So adding this will just increase start-up time. So all of this should be cleared say when frmMenu is unloaded or game loop execution ends or something. (But unless what iRicardo said is true, that VB doesn’t clear strings then this might be useful.)

Declare something like this:

public i as string * 10

And use the code:

If Len (Trim $ (i)) = 0 then msgbox "Okay" else "Msgbox "No" then

The visual basic will recognize that “i” (which was not changed) is not blank.

Declare something like this:

public i as string * 10

And use the code:

If Len (Trim $ (i)) = 0 then msgbox "Okay" else "Msgbox "No" then

The visual basic will recognize that “i” (which was not changed) is not blank.

oh, I get it. Vb I simply allocating space and storing null values in them. But what Seakru said is wrong. Adding the clear method in Main will have no effect logging out to the Main Menu and logging back in. (i.e if that is what exactly he is going to do)

Log in to reply