#1 24-08-2007 15:26

Seemann
Registered: 07-08-2006
Posts: 2,156

Sanny Builder / CLEO discussion

Feel free to ask any questions related to Sanny Builder or CLEO here. All posts must be written in English.
Thanks.

Offline

#2 29-08-2007 18:31

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

Is it possible to use $PLAYER_ACTOR as variable in CLEO? If I want for example, to check if other variable is equal to $PLAYER_ACTOR, i get an error: "One of the variables has unknown type, or operands are incompatible." I think this is because CLEO script and main.scm files are separate scripts and $PLAYER_ACTOR doesn't exist in that CLEO script but I still can use it in other ways.

Offline

#3 29-08-2007 19:17

Sanchez
Registered: 18-08-2006
Posts: 280

Re: Sanny Builder / CLEO discussion

See help:

a) declared a variable of a type using VAR..END, but in fact used this variable with another type;
b) both of the variables weren’t declared through the VAR..END;

For example:

{$CLEO}

var
    $PLAYER_ACTOR: Integer
    $test: Integer = 0
end

if
    not $PLAYER_ACTOR == $test
then
    Player.Money($PLAYER_CHAR) += 99999
end

0A93: end_custom_thread

Last edited by Sanchez (29-08-2007 19:18)

Offline

#4 29-08-2007 21:46

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

And GTA SA crashes when I declare $PLAYER_ACTOR

Offline

#5 30-08-2007 01:57

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

You can't use new global variables except those declared in the CustomVariables.ini. That's because the compiler knows nothing about global variables storage in the main.scm (how much variables it uses, what are their names), and it compiles new global variable beginning with the first allowable name, which is $2. So, adding a new variable with custom name, you actually creates new variable $2 in you script. If you know, such variable is defined as $PLAYER_CHAR in the CustomVariables.ini file. Your new variable's value just rewrites the value of $PLAYER_CHAR, and it may cause a game to be crashed. Yet anothor global variable will be compiled as $3, which is $PLAYER_ACTOR, and will rewrite its value.

So, you can't add new variables. If you need to check $PLAYER_ACTOR (why, btw?), you're only allowed to compare it with a local variable. Either declare both of them as integer, as you adviced before, or use the proper opcode:

803C: NOT $PLAYER_ACTOR == 9@

Offline

#6 14-10-2007 09:44

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

How to make sanny builder know that CLEO mission is mission? I want to use variables from 34@ to 1024@. I know I can disable limit in options but then there may be unspotted bugs... Could you make directive like {$MISSION} or {$M} to increase limits to mission limits?

Offline

#7 14-10-2007 11:25

Sanchez
Registered: 18-08-2006
Posts: 280

Re: Sanny Builder / CLEO discussion

The CLEO-scripts could be used as missions. The compiling process is the same, but the output file must have the extension .cm (Custom Mission). To start this mission, use the opcode 0A94.

Offline

#8 14-10-2007 12:33

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

2Sanchez:
He asked for another thing. I think he knows how to make a CLEO mission. wink

2Devan_LT:
I could make it so, the compiler will not complain about locals limits, if there is a $CLEO directive with .cm parameter ({$CLEO .cm}). Because in anyway, when you make a CLEO mission, you use this, so I think an additional directive isn't needed. OK?

Offline

#9 14-10-2007 17:55

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

2Devan_LT:
I could make it so, the compiler will not complain about locals limits, if there is a $CLEO directive with .cm parameter ({$CLEO .cm}). Because in anyway, when you make a CLEO mission, you use this, so I think an additional directive isn't needed. OK?

Hmm. I didn't think about that tongue Would be nice smile

Last edited by Devan_LT (14-10-2007 17:55)

Offline

#10 15-10-2007 21:15

IceBrain
Registered: 15-10-2007
Posts: 1

Re: Sanny Builder / CLEO discussion

Hi. Just wanted to ask something: Is there any possibility of passing Strings to DLL functions, in CLEO scripts?

Offline

#11 16-10-2007 08:42

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

IceBrain wrote:

Hi. Just wanted to ask something: Is there any possibility of passing Strings to DLL functions, in CLEO scripts?

You can pass a POINTER to that string. For example, if you have some string in variable 1@s:

1@s = 'MYSTR'

To pass a pointer, you need to calculate it by adding 0x3C and number of variable multiplied by 4 to the thread pointer:

0A9F: 0@ = current_thread_pointer
0@ += 0x3C
0@ += 4 // variable 1@s => 1 * 4

Now 0@ contains address of the string MYSTR in game memory. You can pass this address using call opcode:

0AA5: call $DLLPROC num_params 1 pop 1 0@

Offline

#12 03-11-2007 22:26

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

Ohhh, I have really good request about CLEO. Making strings that work just like GXT strings. For example, I write 'MYSTRING' = "Do you see this message?" and below 00BC: show_text_highpriority GXT 'MYSTRING' time 1000 flag 1. And the game would show: Do you see this message?
I know this is somehow possible to make without that, like in ShowTextBox.s but I'm not a programmer and that would be hard for me...
Maybe just to make it like this:
0AB5: set GXT string "Do you see this message?" for string 'MYSTRING'

Offline

#13 04-11-2007 06:45

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

I wrote the GxtHook plugin specially to make using the custom GXT entries as easy as it's even possible. Have you considered using it?

Offline

#14 04-11-2007 12:07

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

ohhhh. I'll try to find everywhere next time before I ask...

Offline

#15 05-11-2007 01:49

supralov3r
Registered: 05-11-2007
Posts: 1

Re: Sanny Builder / CLEO discussion

Never mind I fixed it!:D

Last edited by supralov3r (05-11-2007 02:03)

Offline

#16 13-11-2007 18:07

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

I need info with file reading. Does it always read file from start? I need to store coordinates to files and then read them. I want to make simple path system to make cars drive like Tenpenny in the last mission. First: I make the script which records the path I drive into the file. Then I make the script which makes car drive exactly as I drove. I want to put this information: X Y Z SPEED Z_ANGLE Y_ANGLE. And code would cycle every 30-40ms to make the car drive smoothly. I think syntax like in Pawn wouldn't be hard for me but not this... Could you explain me that?

Offline

#17 14-11-2007 01:56

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

2Devan_LT:
The easiest way to do that is using the RRR paths. It’s the way Rockstar used in their missions. They are well-documented, have all the features you need (smooth movement at any coord, under any angle). There’s a CLEO script allowing you to record a vehicle movement. Then you add a new RRR path to the carrec.img and assign any vehicle to it. More information about these paths and tools is here and here.
Here is the code example, how to assign a vehicle to a path.

Offline

#18 14-11-2007 15:19

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: Sanny Builder / CLEO discussion

Seemann wrote:

2Devan_LT:
The easiest way to do that is using the RRR paths. It’s the way Rockstar used in their missions. They are well-documented, have all the features you need (smooth movement at any coord, under any angle). There’s a CLEO script allowing you to record a vehicle movement. Then you add a new RRR path to the carrec.img and assign any vehicle to it. More information about these paths and tools is here and here.
Here is the code example, how to assign a vehicle to a path.

thanks for the help! smile
edit: oh, finally I found out how to use file reading. I will use your help if I can't do this using my own code. Car drives a little bit laggy and there are little problems with rotation but that way makes sure there won't be any conflicts between this and some other mod that somebody can make smile

Last edited by Devan_LT (14-11-2007 20:35)

Offline

#19 19-11-2007 09:23

tehfatguy
Registered: 19-11-2007
Posts: 1

Re: Sanny Builder / CLEO discussion

Does Sanny Builder 3.03 require SA now?? I have tried to set the game directory to my GTA 3 directory but it won't work... Would someone please be able to help me?

Offline

#20 19-11-2007 09:32

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

2tehfatguy:
Make sure you set a current edit mode to GTA3. See that menu shown, when you click in the bottom right corner of the program? Choose the GTA3, and set the game directory. Should work.

Offline

#21 19-11-2007 21:32

Aschratt
From: Chemnitz
Registered: 07-11-2007
Posts: 8
Website

Re: Sanny Builder / CLEO discussion

Is there an possibillity to create substrings? If not... would it be possible to create one? Or general String-Operations would be cool (IndexOf(), LastIndexOf(), GetLength(),...) ^^


gwmsignatureapvnw.jpg

Offline

#22 20-11-2007 08:27

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

Aschratt wrote:

Is there an possibillity to create substrings?

Substring is a part of given string ('str' is a substring of 'string'), yes? If so, I dunno, is it really needed? There's one string operation I know that supported by opcodes is concatenation (098B, 098C). But R* never used it, and no one too. Same goes to all string functions. If you give me some examples where you need such advanced opcodes, I probably change my opinion wink

Oh, and btw you can use those functions that are already in the exe. For example, function at 00826330

Get the length of a string
.text:00826330 ; size_t __cdecl strlen(const char *str)

Opcode

0AA7: call_function 0x00826330 num_params 1 pop 1 0@ 1@

where 0@ is a pointer to string (see post #11 in this topic), should store to 1@ the length of given string.

Offline

#23 20-11-2007 20:06

Aschratt
From: Chemnitz
Registered: 07-11-2007
Posts: 8
Website

Re: Sanny Builder / CLEO discussion

Well... For example you could create some nice text-inputs or animated text outputs...
It is not necessary, but at least you got more possibillities.


gwmsignatureapvnw.jpg

Offline

#24 29-11-2007 09:58

Midnightz
From: U.S.
Registered: 26-08-2007
Posts: 39
Website

Re: Sanny Builder / CLEO discussion

Sanchez wrote:
var
    $PLAYER_ACTOR: Integer
    $test: Integer = 0
end

if
    not $PLAYER_ACTOR == $test
then
    Player.Money($PLAYER_CHAR) += 99999
end

I don't get it.  crazy  I mean, I get it... for that instance but can't see how it applies to what I'm trying to do.  Err, I haven't had to do anything special to use common globals like $PLAYER_ACTOR - they're working just dandy without me converting anything to permit the use of them AFAIK.  Please elaborate if what I'm doing will eventually cause a crash? :wow:

Separately, I need to make my CLEO script check a dma var (from scm) and tell me if it's doing X... I have had no success so far.

:MOVEIT_DOOR
03CA:   object $9811 exists 
jf @MOVEIT_COND
if or
0837:   object $9811 animation == "CLO_Pose_In_O" 
0837:   object $9811 animation == "CLO_Pose_Out_O" 
jf @MOVEIT_COND
...blah blah blah

Can you or Seemann tell me if this is impossible to do in a CLEO script -OR- how to accomplish it correctly?

Many thanks in advance,
-Midnightz

Last edited by Midnightz (29-11-2007 10:07)

Offline

#25 29-11-2007 11:25

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Sanny Builder / CLEO discussion

Midnightz wrote:

Err, I haven't had to do anything special to use common globals like $PLAYER_ACTOR - they're working just dandy without me converting anything to permit the use of them AFAIK.  Please elaborate if what I'm doing will eventually cause a crash?

Yes, you don't need to do something special to use the globals.

Separately, I need to make my CLEO script check a dma var (from scm) and tell me if it's doing X... I have had no success so far.

Make sure the other part of the script is correct. I haven't see anything wrong in that one you posted.

Btw, if you're going to deal with something from the original scm, check if the script of given name is running, using

0AAA: 0@ = thread 'WARROBE' pointer
if
 0@ > 0
then
 .... // thread running, go on
end

it's going to be an additional measure to prevent crashing for those who will use this CLEO script on modded scms (without external scripts).

Offline

Board footer

Powered by FluxBB