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 


Getting variable and displaying in vb 2008

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
_NoX_
Master Cheater
Reputation: 0

Joined: 17 Feb 2009
Posts: 471
Location: UK

PostPosted: Wed May 20, 2009 5:42 am    Post subject: Getting variable and displaying in vb 2008 Reply with quote

hell, this may be a very simple open and shut problem. Im making trainer and want to display variables from the swf i load, i thought it would be the same as setting variables but instead of editing with a text box the variable will be displayed in it, unfortunately its not . im looking for a straight forward answer and obviously an example if possible.

cheers in advance

_________________

Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed May 20, 2009 5:56 am    Post subject: Re: Getting variable and displaying in vb 2008 Reply with quote

xjohnnox wrote:
hell, this may be a very simple open and shut problem. Im making trainer and want to display variables from the swf i load, i thought it would be the same as setting variables but instead of editing with a text box the variable will be displayed in it, unfortunately its not . im looking for a straight forward answer and obviously an example if possible.

cheers in advance

Instead of using SetVariable you use GetVariable it takes a string as argument and then returns a string value.

so you can like do
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = AxShockwaveFlash1.GetVariable("Score")
    End Sub


If the variable doesn't exist then it will throw an exception. So you can add some nice error handleing
Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Label1.Text = AxShockwaveFlash1.GetVariable("blah")
        Catch c As System.Runtime.InteropServices.COMException
            MessageBox.Show("the variable does not exist")
        End Try
    End Sub

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
92Garfield
I'm a spammer
Reputation: 57

Joined: 20 Dec 2007
Posts: 5871
Location: Banana Republic Germany

PostPosted: Wed May 20, 2009 7:42 am    Post subject: Reply with quote

since it crash when variables doent exist you should always use it with

On Error Resume next

because usually variables dont exist when not used

_________________
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed May 20, 2009 7:49 am    Post subject: Reply with quote

Epic Cat Garfield wrote:
since it crash when variables doent exist you should always use it with

On Error Resume next

because usually variables dont exist when not used

Can you use on error with a label? Like

Code:
On Error Go To ErrorHandeler

Code:
:ErrorHandler

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
92Garfield
I'm a spammer
Reputation: 57

Joined: 20 Dec 2007
Posts: 5871
Location: Banana Republic Germany

PostPosted: Wed May 20, 2009 12:00 pm    Post subject: Reply with quote

yes, but you have to make sure errhandler is only called when err comes up

like

if 1=2 then
:errhandles
...
end if

_________________
Back to top
View user's profile Send private message
_NoX_
Master Cheater
Reputation: 0

Joined: 17 Feb 2009
Posts: 471
Location: UK

PostPosted: Wed May 20, 2009 4:29 pm    Post subject: Reply with quote

oh so u dstart with where u want the value to appear before u ask for the var, ty for the help guys, much appreciated
_________________

Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed May 20, 2009 5:03 pm    Post subject: Reply with quote

xjohnnox wrote:
oh so u dstart with where u want the value to appear before u ask for the var, ty for the help guys, much appreciated

Yes. The property that you want to assign a new value for is placed left to the equal sign and the value is placed to the right.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Wed May 20, 2009 5:22 pm    Post subject: Reply with quote

Epic Cat Garfield wrote:
since it crash when variables doent exist you should always use it with

On Error Resume next

because usually variables dont exist when not used



Not the best thing to do

if a error happens it just goes on next line.. it might actually mess up your hack doing that

better to do

'exits on error but u won't get any return
On Error Exit Sub
or
On Error GoTo Endd

Code:
Function doesVariableExist(Variable$) as Boolean
On Error GoTo Endd
value$ = blahblah.GetVarible(Variable$)
doesVariableExist = True
Endd:
doesVariableExist = False
End Function

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
_NoX_
Master Cheater
Reputation: 0

Joined: 17 Feb 2009
Posts: 471
Location: UK

PostPosted: Wed May 20, 2009 6:04 pm    Post subject: Reply with quote

well i managed to get the vars i wanted and have them displayed but now i have another problem, one of the vars i need well doesnt do what it says and i cannot locate any other that does the same job. better if i tell u what im hacking. starfighter disputed galaxy. i want it to display the total number of AI/npc ships, i have managed to display both number of REAL players and total number of ships, now i was wondering if there is no var for the total AI ships then would u be able to do a calcuation to be displayed in a label. for example:

total ships - real players
this would leave AI ships but have no idea how i would make this work

help would be appreciated

_________________

Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Thu May 21, 2009 4:25 am    Post subject: Reply with quote

pkedpker wrote:
Epic Cat Garfield wrote:
since it crash when variables doent exist you should always use it with

On Error Resume next

because usually variables dont exist when not used



Not the best thing to do

if a error happens it just goes on next line.. it might actually mess up your hack doing that

better to do

'exits on error but u won't get any return
On Error Exit Sub
or
On Error GoTo Endd

Code:
Function doesVariableExist(Variable$) as Boolean
On Error GoTo Endd
value$ = blahblah.GetVarible(Variable$)
doesVariableExist = True
Endd:
doesVariableExist = False
End Function


Or you can catch exceptions. That is also powerfull. Becuase when a program crash what's really happening is that a exception is thrown and the program isn't programmed to catch it. All operations and components are assgined exceptions. So if the exception isn't thrown there is no way for the program to crash.

xjohnnox wrote:
well i managed to get the vars i wanted and have them displayed but now i have another problem, one of the vars i need well doesnt do what it says and i cannot locate any other that does the same job. better if i tell u what im hacking. starfighter disputed galaxy. i want it to display the total number of AI/npc ships, i have managed to display both number of REAL players and total number of ships, now i was wondering if there is no var for the total AI ships then would u be able to do a calcuation to be displayed in a label. for example:

total ships - real players
this would leave AI ships but have no idea how i would make this work

help would be appreciated

total ships - your ships would be equal to ai ships , imo.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
_NoX_
Master Cheater
Reputation: 0

Joined: 17 Feb 2009
Posts: 471
Location: UK

PostPosted: Thu May 21, 2009 5:26 am    Post subject: Reply with quote

@beloved hero how would i right that in vb 2008

label1 = Label2 - Label3 ???

label1 being no of ai
label2 being no of ships
lebel3 being no of players

and also i do not know if this is in right area but i problem has just started affecting me. when i am done with a trainer for the night i click save all to save everything and then close the program. next day i click to loadit up and nothing happens, there is a slight loading delay but nothing loads, no forms nothing in the panel to the right??? this is a major problem and now i cannot edit noredoing anything with the trainer again. this is a major problem i need fixing and any answers as to why it is not loading would be much appreciated

_________________

Back to top
View user's profile Send private message MSN Messenger
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