Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VB6 Variable Testing Help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Sun Nov 11, 2007 10:23 am    Post subject: VB6 Variable Testing Help Reply with quote

Ok, I'm trying to make a variable tester which tests if a variable exists or not in a certain flash game. So the user types in a variable such as _root.score and presses the button which checks if it's real. Then it has a message popping up saying if it finds it or not.

I tried looking on the internet but couldn't find anything useful

My junk code:

Code:
Private Sub Command1_Click()
If flash1.GetVariable(Text1.Text) Is Nothing Then
MsgBox ("Variable Not Found")
Else
MsgBox("Variable Found")
End If
End Sub


I'm thinking my second line is wrong
Please help, I'm a noob at this -.-
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sun Nov 11, 2007 12:37 pm    Post subject: Reply with quote

Code:
Private Sub cmdTestVar_Click()
On Error GoTo errorhandler
label1.Caption = General.game.GetVariable(txtVar.Text)
Exit Sub
errorhandler:
MsgBox "The variable doesnt exist!", vbInformation, txtVar.Text
End Sub
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Sun Nov 11, 2007 12:41 pm    Post subject: Reply with quote

Thanks
So I replace general.game with my shockwave name right?
Trying...

EDIT: It works!
Thanks again =)
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Nov 11, 2007 1:28 pm    Post subject: Reply with quote

Just a suggestion, you could setup the function to pass the object, the variable, a pointer to the return variable storage, and have the function also return true or false for more 'error' checking.

Something like this:

Code:
Private Function CheckVariable(swObj As ShockwaveFlash, strVariable As String, ByRef valPtr As Variant) As Boolean
On Error GoTo ErrorHandle

    Dim vValue As Variant
    vValue = swObj.GetVariable(strVariable)
    valPtr = vValue
    CheckVariable = True
    Exit Function

ErrorHandle:
    CheckVariable = False
End Function


An example use for Dragon Fable would be:

Code:
Private Sub Command1_Click()
    Dim bVariable   As Boolean
    Dim lngVarValue As Long
    bVariable = CheckVariable(ShockwaveFlash1, "_root.character.intGold", lngVarValue)
    If bVariable = True Then
        MsgBox "Variable exists! Value: " & lngVarValue
    Else
        MsgBox "Variable didn't exist."
    End If
End Sub

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites