Shifu-Hacks Blog

愚かさは博学ではない。

More Control!

Posted by compactwater on August12 2007

So, you know how to hack Flash Games now… But, you want more control, don’t you?  You can change almost anything in the game, but by using simple controls, you can make it easier, and more user-friendly. For this example, lets say you’re playing a racing game, and you happen to find a variable”_level10.player1.speed“. With that, you can change the speed, but what if you wanted to go slower, or faster? The user would have to change the Editbox to the speed, which may cost them the race.

You could do this many ways, but in this example, I will use hotkeys (GetAsyncKeyState) and a track-bar. Position your track-bar in a reasonable location on your form, and add a timer. Set the Interval on the timer to 20 milliseconds, the average input speed of a keyboard. Click on the track-bar, goto the ‘events’ tab on the Object Inspector, and make an OnChange event by double-clicking on the OnChange drop-down.  To make the variable change to the track-bar’s position, you need “TrackBar1.Position“, but because this is an integer, you will also need to use “IntToStr”, which will convert the integer to a string.

Now back the the OnChange event, add
ShockwaveFlash1.SetVariable(‘_level10.player1.speed’,IntToStr(TrackBar1.Position);
to the OnChange event of the track-bar, that will change your speed on the game to the track-bar’s position. You may want to change the maximum and minimum (Labeled Max and Min) of the track-bar higher or lower, depending on the game.

What about the timer? That’s for your hotkeys. To do hotkeys, I will use GetAsyncKeyState, which requires a Virtual Key. Here’s a quick example:
if Odd(GetAsyncKeyState(VK_F2)) then
TrackBar1.Position:=TrackBar1.Position+10;

Don’t understand what’s going on?
if –  if X happens…
Odd – if X is an odd number…
VK_F2 – Is the virtual key for F2, and when pressed, GetAsyncKeyState will return an odd value.
then – then do Y.
TrackBar1.Position:=TrackBar1.Position+10 – Will set the track-bar position to it’s current value +10.

There is something you should know when setting hotkeys, never use Alt+Function keys, F1, F12, and in some cases, F5. The reason is, some hotkeys are already being used, or may be in use on another computer. F1 is the universal key for ‘help’, and F12 is for ‘Debug’ or “Break’, and F5 is ‘refresh’, but it is also commonly used for other things.

Other controls are basically the same, but would work better in different situations. Find the one right for what you’re trying to do, and make your program more user-friendly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: