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 


[issue] [Delphi] incompatible types.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Sun Aug 05, 2007 1:22 pm    Post subject: [issue] [Delphi] incompatible types. Reply with quote

Okay I'm using a function that is included in Delphi to get and set a variable from an online Flash game. Here is the part of the code:

Code:
procedure TForm1.ItemTimer(Sender: TObject);
begin
try
DF.GetVariable('_loc2');
DF.SetVariable('_loc2', 'I want to put a number here');
Except
end;
end;


Now the problem is I can only seem to set the variable _loc2 to a String's value, not a integer etc.

If I try that, I get an incompatible types error on compiling, and if I ran it with a String type data, I get a logical/runtime error. The game seems to have error handling and handles whatever I set it to as NaN. Also InttoStr doesn't work, I've tried it.

Is there any way to set this to an integer? I've looked at some stuff on Google, but the best I got is the "is" and "as" operator.

And if the solution involves somehow overloading the function to include other types of input, I'll need some serious help Neutral.

_________________


Last edited by Xanatos on Sun Aug 05, 2007 1:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sun Aug 05, 2007 1:27 pm    Post subject: Reply with quote

IntToStr
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 1:30 pm    Post subject: Reply with quote

try
IntToStr(edit1.text);
for a text box to set the value
if u just want a number then

IntToStr('number');
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Sun Aug 05, 2007 1:31 pm    Post subject: Reply with quote

InttoStr doesn't work (i'm not a complete retard)

The function will still give me an error, and I know how to use that.

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 1:32 pm    Post subject: Reply with quote

what error?
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Sun Aug 05, 2007 1:33 pm    Post subject: Reply with quote

Incompatible types. Again.
_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 1:38 pm    Post subject: Reply with quote

wierd...
i put it in my procedure and it works...
i put this, with the value 33 and it work...
try
DF.GetVariable('_loc2');
DF.SetVariable('_loc2', '33');
Except
end;

what is df, its a shockwaveflash?
maybe u named it something else.. check
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Sun Aug 05, 2007 1:40 pm    Post subject: Reply with quote

Yeah, but won't that change it to a String?

Because there are quotes around the 33.

Also yes, DF is a shockwaveflash, and everything works peachy when I put in a string -.-.

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 1:48 pm    Post subject: Reply with quote

umm try
try
DF.GetVariable('_loc2');
DF.SetVariable('_loc2', edit1.Text);
Except
end;
?
if u dont want to use a text box use label1.caption and make it invisibe?
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Sun Aug 05, 2007 1:49 pm    Post subject: Reply with quote

Symbol wrote:
umm try
try
DF.GetVariable('_loc2');
DF.SetVariable('_loc2', edit1.Text);
Except
end;
?
if u dont want to use a text box use label1.caption and make it invisibe?


Caption and Text are also String types, I need integers.

And yes... I tried text. (I'll try caption for the heck of it).

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 1:53 pm    Post subject: Reply with quote

but if u type a number?
try using variables i guess there are few was to do it with vars...
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Sun Aug 05, 2007 1:56 pm    Post subject: Reply with quote

Symbol wrote:
but if u type a number?
try using variables i guess there are few was to do it with vars...


Again won't work Sad. The function only allows widestring types. So is there another one I can use to set that var?

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 1:58 pm    Post subject: Reply with quote

why not using a string then...?
i dont know much about shockwaves trainers.. sorry =\
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Sun Aug 05, 2007 2:01 pm    Post subject: Reply with quote

Symbol wrote:
why not using a string then...?
i dont know much about shockwaves trainers.. sorry =\


Strings are handled as NaN, and there the variable I'm trying to change will allow to me chose what item is generated when I complete a quest. And there isn't an item ID for NaN Sad.

_________________
Back to top
View user's profile Send private message
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Sun Aug 05, 2007 2:31 pm    Post subject: Reply with quote

It's passed as a WideString I believe, so put '1000' not 1000.
It would be the same thing.
If you can't get the variable, that means it doesn't exist, or doesn't exist yet.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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