HOW TO MAKE A LUA SCRIPT GAME GUARDIAN

HOW TO MAKE LUA SCRIPTS GAME GUARDIAN

Starting from version 8.28.0 game guardian included a  support for LUA scripts.We can now make lua scripts for literary any game we play.This guide will take you through the full scripting tutorial from scratch assuming you have NO previous programming  knowledge. By the end of this you should be able to create a script for your favorite game let’s get started.

REQUIREMENTS FOR MAKING A LUA SCRIPT

Starting off you need to know that game guardian scripts are made using a programming language called LUA hence the name Lua scripts for game guardian. Keep this in mind as we will be using Lua syntax,functions and rules.Don’t let these words scare you off we will try to make this guide as easy to follow and understand as possible.

To make a game guardian lua script we will require only two apps

  • Game Guardian version 8.28.0 or higher

Game guardian is a basic requirement as it’s the app responsible for executing scripts however you can only use game guardian 8.28.0 or higher as the versions before this do not support lua scripting. You will however note that game guardian only supports scripts execution but does NOT support script writing or editing. Currently the only way to create a lua script for game guardian is to use a third party application which brings us to our second requirement.

Download the latest version of game guardian

  • Lua editor

As stated above the only way to create or edit a game guardian lua script is through a third party application.This is where the Q-Lua app editor comes to the rescue. Through the editor we can write and save our scripts after which you can execute it using game guardian.

Download the latest version of Q-Lua editor

After installing Q-Lua we need to allow storage permissions to allow saving of scripts to do this go to your device settings then navigate to apps where you can view all apps installed on your device locate and select Q-Lua  and you’ll be brought to the screen shown below click on permissions.

After selecting permissions you’ll be brought to the screen shown below make sure the storage option has been checked as shown in the image below this will grant storage permissions to Q-Lua and will allow you to create, save and edit scripts on your device.

After doing this you’re good to go and you can now create your first game guardian lua script.

STEPS OF MAKING A GAME GUARDIAN LUA SCRIPT

STEP 1: Install and launch both game guardian and qlua app editor you should have the game guardian floating window over the open qlua interface as shown in the image below. Click on editor to create a new empty lua script.

STEP 2: You will be brought to a screen as the one shown below with an empty lua script.

Click on the save icon and choose a name for your lua script. In the example below I will save my script as “trial.lua”. You can change the name before the extension to whatever you want e.g. if you want to make a script that grants unlimited gems you’d save it as “unlimitedgems.lua” instead. Note that the extension “.lua” is very important and must be included to avoid errors.

STEP 3: After saving your script you’ll be brought back to your blank lua script we will now begin by adding a script menu that will allow your script user to select an option. This is where lua scripting comes into play we will begin by learning how to make a menu as the one shown below.

HOW TO MAKE A LUA SCRIPT MENU

As you can see the script has four options that the user can choose from option 1-4.To achieve the same result we need to use codes to “tell” game guardian we need a menu with the specified options.To do this we will use the codes shown below.

menu=gg.choice({‘Option 1′,’Option 2′,’Option 3′,’Option 4’})

You will input the code exactly as shown above into the qlua editor after which you’ll click on the save button as shown in the image below.

STEP 4: After saving your lua script successfully we need to test it using game guardian to ensure that everything is working as expected.To do this we will open the game guardian interface and select the execute script option shown below note that you can use any process/activity to test scripts doesn’t necessarily have to be qlua process.

On clicking on the button shown above an interface will open up asking you to select the script file you want to execute navigate to the directory where you saved your lua script you will notice your lua script highlighted in green with the name you assigned to it as shown below.

STEP 5: After selecting your script click on the execute button shown below to run the script

If you have done the above steps correctly you should be able to see the screen shown below.

As you notice this is a menu with 4 options and the user can select either of the options you can however change the ‘option 1’ to anything you want lets change the wording to see how this works.This time I will create a menu with different option to do this I will use the code below:

menu=gg.choice({‘Subscribe’,’Unlimited Gems’,’Super Speed’,’Exit’})

As you’ve noticed this time I have used a slightly different menu however the code structure remains the same when you save and execute the code above we will have the menu shown below

Now that you’ve understood the basics of creating a script menu we will dive a little bit deeper on how to make the script responsive.You will notice that when you select any option in the list the script does nothing instead it just ends with a notification as shown below.

MAKING THE LUA SCRIPT RESPONSIVE

We will now learn how to make the lua script responsive such that when you click on or select any option the script does what it’s expected to do. For this we will add code to instruct it on what to do depending on the user’s selection.For this we will use our new menu that we just created.

menu=gg.choice({‘Subscribe’,’Unlimited Gems’,’Super Speed’,’Exit’})

We will start by the first option “Subscribe”.I want to make this script responsive such that anytime anyone clicks on subscribe it will show a message “Subscribe to ronoplays.com” but how do we do this?

Showing alerts/messages using lua scripts

First we need to know what code we will use to show alerts/messages to users for this we will use a simple code:

gg.alert(”)

anything between the brackets will be shown to the users as a message so to show our message to the user we will write:

gg.alert(‘Subscribe to ronoplays.com’)

Now that we know the code to show alerts we can integrate this to our menu so that if the user select subscribe our message is shown to them.For this we will use a simple if statement. Since we have assigned the table to a variable “menu” we can specify actions In relation to the variable menu as shown below.

menu=gg.choice({‘Subscribe’,’Unlimited Gems’,’Super Speed’,’Exit’})

if menu==1 then

gg.alert(‘Subscribe to ronoplays.com’)

end

The code above simply instructs the lua script to give the user a message “Subscribe to ronoplays.com” if they select the first option. Type and save the code above into your lua editor as shown below:

When we execute the code above and select the first option “subscribe” we get a response shown below.

Now that you are familiar with the functionality lets add code for the second option “Unlimited gems”.For this we will need to search and replace a value for gems let’s take for example we’re playing a game and currently only have 10 gems but we want to change this to 1000 how do we write a script to do this?

SEARCHING FOR VALUES

Searching for values using a lua script is easy all we need to know is the value were searching for and its data type for this example I will use the value 10 and the data type dword.The code for searching in game guardian is

gg.searchnumber(’10’,gg.TYPE_DWORD)

The code above will search for the number 10 data type dword.Note that you can change the value 10 to anything you want to search for

SELECTING VALUES TO EDIT

After searching for values we have to select the values we want to edit from the result list before attempting to edit.To do this we use the code below

gg.getResults(100)

Note that the 100 in brackets is the number of results we want to select you can change this to any amount of results that you want to edit.

EDITING VALUES

Now that you’ve known how to search and select the values you want to edit we will learn how to edit your selected results.To edit we use the code below

gg.editAll(‘1000’,gg.TYPE_DWORD)

The code above will edit all selected results to whatever values they currently have to 1000.Note that you can change the 1000 to whatever value you want.

Now that we know how to search,select and edit results let combine these codes into one to do all these activities progressively.To do this we will combine the code as follows:

gg.searchnumber(’10’,gg.TYPE_DWORD)

gg.getresults(100)

gg.editAll(‘1000’,gg.TYPE_DWORD)

The code above will search for the number 10 select the first 100 results and edit them to 1000.Now that we have the full code for searching and replacing our gems value lets include this code to only run when the user selects option two from our menu above.For this we will use an if statement as we did with our first option in the menu.Combined the whole code should be as shown below

menu=gg.choice({‘Subscribe’,’Unlimited Gems’,’Super Speed’,’Exit’})

if menu==1 then

gg.alert(‘Subscribe to ronoplays.com’)

end

if menu==2 then

gg.searchnumber(’10’,gg.TYPE_DWORD)

gg.getresults()

gg.editAll(‘1000’,gg.TYPE_DWORD)

end

As you will notice we now have our menu and 2 if statements to give a response when the user selects them you will notice that the last 2options “super speed and exit” just end when selected as we have not yet added responsive code for either.The format is the same if we want to add code now lets add code for super speed.

SPEED HACK

To access speed hack with game guardian we normally long press the floating window and a speed interface attaches to the floating window from where we can increase or decrease speed.The same feature can be used in scripts,The code for speed is

gg.setSpeed(100)

Note that the value between brackets (100) is the amount of speed you want normal being zero and maximum being 3600

To test speed features I recommend gg tester application that will help you test if your speed hack code works.

Download gg tester

Now that you’ve known how speed can be implemented in scripts lets add this code to our menu inclusive of all hacks we looked at above.Our lua script will look as shown below.

menu=gg.choice({‘Subscribe’,’Unlimited Gems’,’Super Speed’,’Exit’})

if menu==1 then

gg.alert(‘Subscribe to ronoplays.com’)

end

if menu==2 then

gg.searchnumber(’10’,gg.TYPE_DWORD)

gg.getresults()

gg.editAll(‘1000’,gg.TYPE_DWORD)

end

if menu==3 then

gg.setSpeed(2)

end

Now that we have looked at the three functional parts of our script.lets learn how to end script.In the case where you want a user to exit from your script we add an option and code to terminate the script when selected.

EXITING FROM A SCRIPT

To exit or terminate a script we use the code shown below

os.exit()

This is an inbuilt lua function that will terminate our scripts.Adding this code anywhere in our code will end the script upon execution.Let’s include the exit option in our script so that if the user selects that option the script ends automatically.To do this we will add functionality for our fourth and last option as shown below:

menu=gg.choice({‘Subscribe’,’Unlimited Gems’,’Super Speed’,’Exit’})

if menu==1 then

gg.alert(‘Subscribe to ronoplays.com’)

end

if menu==2 then

gg.searchnumber(’10’,gg.TYPE_DWORD)

gg.getresults()

gg.editAll(‘1000’,gg.TYPE_DWORD)

end

if menu==3 then

gg.setSpeed(2)

end

if menu==4 then

os.exit()

end

If the user selects the exit option the script will terminate with the message below.

If you have reached this point of the guide then you have acquired all basics of scripting.You can download my scripting ebook to get advanced scripting guides .

Download my scripting ebook

I also recommend you watching the videos below to better understand scripting.Have any questions or need help on something comment below to get help from me.

Want to ask for help on something you did not understand ? Join our friendly community to get help

Home forums HOW TO MAKE A LUA SCRIPT GAME GUARDIAN

This topic contains 0 replies, has 1 voice, and was last updated by  ronoplays 4 months, 2 weeks ago.

You must be logged in to reply to this topic.