Intro to Cleo and your first script
I see you want to become a Cleo scripter! First off I just want to say congrats on the choice.
Cleo is fun and very easy once you get the hang of it. Your first couple days will be kind of difficult
though.

The program made for creating CLEO scripts is called SannyBuilder. You can find it here:
Sanny Builder 3

Oh, and you need either a patched Gta San Andreas or have US V1.0 or EUR V1.01
It hasn't been tested out yet but if you find a way to work it with other versions please let us know!

Now that you have Sanny Builder 3, it is time to begin your journey into Scripting.

Alright you will notice a couple of things on the first launch. Look at the bottom right of the screen, you will notice a little box that says CLEO that is red bordered. Double click that little box to bring up the CLEO library installer. Click somewhere in the box then hitok. You now have CLEO library installed and we are ready to make our first script!

Your First Script

Well, now that you have pretty much all the requirements to make your script. Let's start by displaying a message when you hit I. First off, there are a couple useful tools I need to tell you about before we go on. First thing, go to the tools menu at the top, then bring the IDE Tools menu out. You have 2 Useful tools that really help out with Scripting.

1st tool is the Coords Manager. This tells you your exact location in Coordinates in the game. This is useful for planning out Character Spawns, Player Spawns, Weapon Pickups etc. and so on.

2nd tool is the Opcode Search. This is pretty much your best friend in the Sanny Builder Program. This tool has a list of every opcode you could possibly use for scripting. This has everything from Actor Spawning to Stat editing. Trust me, you are going to need this alot when scripting.

Alright enough with this Jibber Jabber. Lets get on with the Script. First you will need to tell Sanny Builder to Compile your script in .cs or .cm format. .cs is the default CLEO extension. .cm is the Cleo Mission extension, used for missions for the game. So at the beginning of this script, put this on the top line: {$CLEO .cs}
This will tell Sanny Builder you are making a Cleo Script. Now we need to name the thread. There are plenty of ways to do this. I just use this as the thread namer: thread 'TEXT' make sure you put the ' at both sides of the thread name. Notice that the word thread is bold and the word text is RED. The bold is used for many things such as jf or jump and many others. The Red words are for names of things such as Animations, Unused objects, etc. Also, make sure after everyopcode, word, or line you press Enter. Otherwise, the script will look sloppy and won't work. Now your script should look like this:

{$CLEO .cs)
thread 'TEXT'

If you did exactly as I said thats what it should look like.

Now on to our first Thread. Threads are important. They pretty much split the Scripts into levels or parts to organize things and put them in a certain order. So before every thread, make sure you put a : (Colon) before the word. Notice that it is bold and green. Many other words are colored. These make them stand out so they are easier to find. But that is not their main purpose. Anyways, lets go on. So our thread name should look like this: :TEXT_1 I usually put an underline then a number. This makes it easier for me. But, you can do it many different ways. Like you can make them completely different words if you want. Whatever tickles your fancy with thread names, Go for it. Our script should look like this:
{$CLEO .cs)
thread 'TEXT'

:TEXT_1

if so, you are doing very well so far. Now onto the actual script. You now are on your way to being a successfulscripter. Anyways, the whole deal with script reading is that the game can read billions of lines in a second. So, in order to make it wait to be able to execute what you want it to do, you need to put this: wait 0. Notice wait turns bold. this is another special word like thread or jf. There are others that do the same. Anyways, there are some scripters who make everything with opcodes. I can't stand it. But other greatscripters can. If you want to be one of those, you can make the wait with opcode 0001: Opcodes are pretty much memory addresses that the game can read to specify certain variables or properties. In simpler words, the game reads opcodes in a special way for certain codes or scripts to be activated. K, so you have made a basic layout for a cleo script so far. Now, it's time for the actual script to take place. Now, its time for theIF variation. The IF is a very important part in a Cleo Script. This variation asks the game if the line below is correct or not. You can also check 2 lines below by adding an if and. So now this line will check to see if our next line has been executed or not. Our next line is used for the key press. Go into yourOpcode Search tool. Search the words key_pressed. TheOpcode search tool will now search every opcode in the dictionary for the keywords specified. You should now have anopcode 0AB0: key_pressed 0x73. This opcode is the check for a pressed key. Copy and paste this into the script one line down from if. Now our script should look like this:
{$CLEO .cs)
thread 'TEXT'

:TEXT_1wait 0
if0AB0: key_pressed 0x73.

It should look like that. Now you have been successful for a part of the script. Now we need to add the actual key that stands for I. the 0X is a hex key. We only need a decimal key. You can find a list of Keys that stand by numbers here. Now, find the I key in the list and look at the number next to it under the word DECIMAL. It should be just 73. So just erase 0x73 and put 73. Now it will check if we pressed I. But, what if we don't press it and it just goes on? Which brings me to our next part, the JF. Now, what jf does is that if the key I isn't pressed, it's going to jump at a certain thread and execute that instead. So basically, it's just an if incorrect check. You can also use jump_if_false but you don't have to. Now next to it, we need to specify the thread it is supposed to jump to if the stated is incorrect. So, next to the word jf or jump_if_false, put an @ sign. Like an email address. This will say jump at a certain thread. So, put @TEXT_1 this will keep reexecuting the thread until I is pressed. Now we need to put a jump to thread IF the specified IS correct. That means, exactly one line under, put jump and an @ sign like jf @TEXT_1. But this time, put jump @TEXT_2. This will jump to the thread that displays the text if we press a button. So, now we have our first successful thread in a script. It should look like this:

{$CLEO .cs)
thread 'TEXT'

:TEXT_1wait 0
if0AB0: key_pressed 73
jf @TEXT_1
jump @TEXT_2


If so, you are successful!
Proceed onto part 2.


0 komentar:

Posting Komentar

 
Top