How To...
[FLASH BASED]
1. Use the SetVariable Function
2. Use the SetVariable Function With User Defined Value
3. Use the GetVariable Function
4. Use the GetVariable Function With A Timer
5. Use SetVariable Function to Freeze Variables
6. Use SetVariable Function to Freeze Variables With On / Off
7. Use the SetVariable Function With User Defined Variable and Value
8. Use the GetVariable Function With User Defined Variable
9. Use the GetVariable Function With User Defined Variable With Timer
10. Use the SetVariable Function with a Combo Box
11. Use the SetVariable Function With Input Box
[GENERAL]
1. Make a Message Box
2. Unload All Forms Before Closing
3. Open a Form
4. Make a Menu
5. Change Form Startup Position
[SWF BASED]
1. Load a SWF From a Website
2. Load a SWF ontop of Original SWF
3. Load a SWF From Application Path
4. Load Base, Movie and FlashVars
5. Load User Defined Property Values
6. Force Loading
7. Reset the Current SWF
[DICTIONARY]
1. VB Commonly Used Words
1. How To Use the SetVariable Function
Firstly, make a command button, then double click it. It should lead into a code window which looks like this:
In the space between the two lines, add this:
| Code: |
| Call ShockwaveFlash1.SetVariable("variable", value) |
Replace "variable" with the variable you'd like to edit, and value with the value you'd like to assign to that certain variable.
2. How To Use the SetVariable Function With User Defined Value
If you want the user to enter his/her own value for the variable, instead of preseting it for them, you need to add a button and a text box. Now enter the button's code by double clicking it. All you have to change is the value to the text property of Text1. If you change them, it would look like this:
| Code: |
| Call ShockwaveFlash1.SetVariable("variable", Text1.Text) |
You still have to replace the "variable" with the variable you found, but now you don't have to worry about the value since the person using your trainer can set it themselves. You should get into the habit of doing this, because it gives the user more control of what they want, because when you used a preset value, they might not like it to be that high or low, etc. This way, it will suit their needs and wants.
3. How To Use the GetVariable Function
What the GetVariable function does is pretty self explanatory, it finds the value of a variable. You need to make a command button and a text box.
Double click the command button, then add this code in the space between the 2 lines:
| Code: |
| Text1.Text = ShockwaveFlash1.GetVariable("variable") |
Replace variable with the variable you'd like to get the value of. This code simply tells it to get the value of what's inside the brackets (the variable) and write it in text1.
4. How To Use the GetVariable Function With A Timer
This is still using the GetVariable function like in my previous one, except this time it repeatedly gets the variable.
Set up a text box and a timer. Click the properties window, and change the interval of the timer from 0 to 1.
Now double click the timer, it should still look at the same the command button code, except some of the events and names have changed. Now enter this code:
| Code: |
| Text1.Text = ShockwaveFlash1.GetVariable("variable") |
Replace "variable" with the variable you'd like to get the value of.
This code still gets the variable, except it does it every milisecond, so if the value has changed, it will record the new value in the text box.
5. How To Use SetVariable Function to Freeze Variables
Freezing a variable can be useful when you want to freeze the variable for health, money, etc. This way, the value will never change, and it's easier than the person setting the variable to a higher number, just to survive and such.
You will need a button and a timer for this. Click the timer, in the properties window to the right, set the interval to 1, and enabled to false. Go into the button code and add this:
| Code: |
| Timer1.Enabled = True |
This turns the timer on when pressed. Now go into the timer, and add your setvariable code:
| Code: |
| Call ShockwaveFlash1.SetVariable("variable", value) |
Replace it with your variable / value and your done! Now, you can apply your knowledge. You could take your knowledge on how to use a text box, and combine it with how to freeze a variable. To do this, you would replace the "value" with your text box name. It will look something like this:
| Code: |
| Call ShockwaveFlash1.SetVariable("variable", Text1.Text) |
The same as How To # 2.
6. How To Use SetVariable Function to Freeze Variables With On / Off
You might be wondering, what if the person wants to disable the hack?
To disable, it's a little more complicated, because you have to use an 'if' statement.
Firstly, set up your button and timer the same as above, and enter your timer code, but for your button, use this instead:
| Code: |
| If Timer1.Enabled = False Then Timer1.Enabled = True Else Timer1.Enabled = False End If |
What this does is, if the user presses the button, and Timer1 is off, it turns it on. If the user clicks it again, and Timer1 is not disabled (it's enabled), it turns it off.
If you wish to change the caption, you would have to add 2 more lines to change the command button's caption:
| Code: |
| If Timer1.Enabled = False Then Timer1.Enabled = True Command1.Caption = "On" Else Timer1.Enabled = False Command1.Caption = "Off" End If |
Change the caption to fit your needs. If you decide to use the caption, which you should, the caption for the command button should be the caption when it's off, so edit that in the properties window.
7. How To Use the SetVariable Function With User Defined Variable and Value
This is usually used when you want the user to enter the variable and value, like a UFT.
It's the same concept as the one with the user defined value, what you do is create 2 text boxes, and 1 command button.
In the command button, you replace BOTH of the placeholders, it would look like this now: (Text1 = Variable, Text2 = Value)
| Code: |
| Call ShockwaveFlash1.SetVariable (Text1.Text, Text2.Text) |
Never use this in a trainer, it's pretty much pointless.
8. How To Use the GetVariable Function With User Defined Variable
Same as above, except this will get the value, text2 will be the output/value, text1 will be the input/variable.
Set up the right controls which would be 2 text boxes, and a button. In the button clicking event, add this:
| Code: |
| On Error Resume Next Text2.Text = ShockwaveFlash1.GetVariable(Text1.Text) |
You must add the "On Error Resume Next" because if the user enters the wrong variable, it will get an error. "On Error Resume Next" means, when there is a error, just continue.
9. How To Use the GetVariable Function With User Defined Variable With Timer
This is the same as above, but it's constantly getting the variable. This concept is the same as How To # 4, so if you get that one, you wouldn't have troubles with this one. This is usually used as a variable 'tester' in a UFT, so I will explain some extra methods you could use with the error handler.
You will only need a timer, and 2 text boxes. Set timer interval to 1. Add this to the code of the timer:
| Code: |
| On Error Resume Next Text2.Text = ShockwaveFlash1.GetVariable(Text1.Text) |
It's the same as above. Now, if you want to display a message such as "Doesn't Exist" when the variable is not found, one method is to add an error handler, so this would be the new code:
| Code: |
| On Error GoTo errorhandler Text2.Text = ShockwaveFlash1.GetVariable(Text1.Text) Exit Sub errorhandler: Text2.Text = "Doesn't Exist" |
When there's an error, it goes to 'errorhandler'. 'errorhandler' makes it display "Doesn't Exist" in Text2. It still does the same thing, except it tells the user that it doesn't exist, because that's the whole point of testing variables right?
10. How To Use the SetVariable Function with a Combo Box
If you wish to use a combo box to set groups of variables such as stat hacks, then firstly make a combo box, and a button. If you want the user to set the value, you may add a text box.
Now, go to your combo box, and in the list property, enter your items on each line.
I'm going to use the items "Hack1", and "Hack2" for this How To, you can change it to fit what you want. Now, go into your button code, and add this:
| Code: |
| If Combo1.Text = "Hack1" Then Call ShockwaveFlash1.SetVariable("Hack1_Variable", Hack1_Value) End If If Combo1.Text = "Hack2" then Call ShockwaveFlash1.SetVariable("Hack2_Variable", Hack2_Value) End If |
If the text of combo1 is Hack1, then set the variable for that hack, and if it's on Hack2, set the other one. If you want to use a text box in there, replace the values:
| Code: |
| If Combo1.Text = "Hack1" Then Call ShockwaveFlash1.SetVariable("Hack1_Variable", Text1.Text) End If If Combo1.Text = "Hack2" then Call ShockwaveFlash1.SetVariable("Hack2_Variable", Text2.Text) End If |
This is used when you don't want to have a button for each variable like set strength, magic, speed, etc. I only used 2 items in mines, you can add as many as you like, just keep repeating the code.
11. Use the SetVariable Function With Input Box
An input box is a message with a textbox that pops up when it's called. To use it with the set variable function, add this to your code:
| Code: |
| Call ShockwaveFlash1.SetVariable("Variable", InputBox("Your Message", "Your Title")) |
Replace the variable, message and title with whatever you want.
Now when the event is triggered, a message prompts the user to enter a value, and it will set it once they have entered it.
1. How To Make a Message Box
If you want to make a message box, the code is fairly simple. Put this code where you want the message box to show, such as in a button click event.
| Code: |
| MsgBox "Message Here" |
If you wish to make your own title, use this:
| Code: |
| MsgBox "Message Here", vbOkOnly, "Title" |
The 'vbOkOnly' is the type of message box it's going to be, you can change it from the list if you want, vbOkOnly is the default message box.
2. How To Unload All Forms Before Closing
If you have more than one form open, such as a hack menu, and you want to close them all when the person closes the main form, go to your main form (Form1), go into the code, and type this in a blank spot:
| Code: |
| Private Sub Form_Unload() Unload Form2 Unload Form3 Unload Form4 Unload Me End Sub |
It's better to unload each form, because using 'End' may cause problems in the memory.
3. How To Open a Form
If you want to open another form, let's say a hack menu, firstly go click the 'Project' menu at the top of your screen, then click 'Add Form...'.
Now, you can add this code to open it:
| Code: |
| Form2.Show |
Replace Form2 with your form you want to open's name.
4. How To Make a Menu
Ever seen those programs which have the menu bar at the top such as 'File', 'Edit', 'View', etc.?
To make one just like those, right-click a blank spot on your form, and then go to 'Menu Editor'.
You can edit the menu from there. To add items to the menu, like a dropdown, you have to press the right arrow, it makes the current menu item drop down from the menu above it.
5. How To Change Form Startup Position
If you ever made a program with lots of forms, you might notice that they all pile up at one location, this is the default location that windows set.
If you want to change it, you can move your forms around in the window to the bottom right which is called 'Form Layout'. Drag that window out for a larger view.
There is also a property called 'StartUpPosition' and you can set it to be in the center and such.
1. How To Load a SWF From a Website
If you wish to load a swf from website, first you need to get the .swf link. After you have obtained it, use this code to load it:
| Code: |
| ShockwaveFlash1.LoadMovie 0, "http://whatever.com/whatever.swf" |
2. How To Load a SWF ontop of Original SWF
If you want to load something such as an SWF hack for games like AQ, DF, and MQ, you must load it higher than layer 0. To do this, just increase the layer to 1, in the LoadMovie function:
| Code: |
| ShockwaveFlash1.LoadMovie 1, "swf link here" |
3. How To Load a SWF From Application Path
Many of the AQ, Df and MQ trainers store their .SWF files in a folder where the .exe is placed such as "\SWF\hack.swf". To gain access and load a swf from this directory, simply use the property 'Path' from the object 'App':
| Code: |
| ShockwaveFlash1.LoadMovie 1, App.Path & "\SWF\Hack.swf" |
4. How To Load Base, Movie and FlashVars
The ShockwaveFlash component has 3 properties that are useful for loading, base, movie, and flashvars. To load these, simply use their properties to load what you want:
| Code: |
| ShockwaveFlash1.Base = "swf url" ShockwaveFlash1.Movie = "swf url" ShockwaveFlash1.FlashVars = "swf url" |
5. How To Load User Defined Property Values
If you want the user to load a swf path, base, flashvars, layer, etc. you use a text box and make what they input fill in the value for these properties:
| Code: |
| ShockwaveFlash1.Base = Text1.Text ShockwaveFlash1.Movie = Text2.Text ShockwaveFlash1.FlashVars = Text3.Text |
You can also use the LoadMovie function to load on seperate layers:
| Code: |
| ShockwaveFlash1.LoadMovie Text4.Text, Text2.Text |
6. Force Loading
Sometimes, certain .swf files don't play when the application is started, to fix this error, go into your form loading event, and enter this:
| Code: |
| ShockwaveFlash1.Playing = True |
Or
| Code: |
| ShockwaveFlash1.Play |
This tells the shockwave flash component to play the .swf when the form is loaded.
7. Reset the Current SWF
Reseting the current .swf is useful when the user wants to reset all cheats he/she has activated, this basically clears out the cheats and starts a new game. Put this in your event when triggered:
| Code: |
| ShockwaveFlash1.LoadMovie 0, " " ShockwaveFlash1.LoadMovie 0, "Url Here" |
Replace the "Url Here" with the .swf url you are using.
What this does is make the component load nothing, so it replaces the original .swf, then it loads the game/file again.
1. VB Commonly Used Words
I might refer to these in some of my How To's, these are just the basic ones you should get to know:
Form - This is what your window is called
Control - These are the controls that you use such as labels, buttons, pictures, timers, and so on
EXE - The executable file
Project - The whole VB work, much like a normal project
Components - You can add these from 'Project > Components...', they are extra things you can add, examples would be an internet control, shockwave flash component, windows media player component, and much more
Properties - You can find these in the property windows to the side, they are basically the properties of the current control
Event - These are the things that are triggered when the user has done something such as clicking a button
======================================================
I'll be updating this for more How To's later on. Please report any non-working code, because I didn't have VB out when I did this, so I might have made some mistakes.
Credits: Blader(Me), and my hands for typing this all out!

No comments:
Post a Comment