CLEO Help [HELP] Cleo

CLEO related
Status
Not open for further replies.

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
Hi,

So I was looking around internet about "Cleo Dialogue tutorials" and stuff and I found only this one but I didn't understand much from it. (http://ugbase.eu/help-7/cleo-dialog-tutorial/)

My question is if you guys know any tutorials out there or have any snippets which you lot can share for learning purposes....

Thanks
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
AVq1zszs.png
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
I don't know any tutorials, but i've worked with dialogs before. So just tell what you want to know and maybe we can help you.
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
How to start up an dialog cleo ?, I mean in every cleo you have different variables at the beginning and stuff


I found two dialog close (one was crypted, but the copy of code was given to me, and other was open source)and they are different to each other at the beginning (note the first one is activated through command and the second one is activated through keypress)


Code:
{$CLEO .cs}
0000: NOP

thread ""

if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end
while not SAMP.Available()
wait 100
end

wait 3000
0af8: "" 0xffffff
0af8: "" 0xffffff

0B34: samp register_client_command "" to_label @dialog

Dialog.Create(1@, "") 
Dialog.AddStatic(1@,1, "", 63, 10, 600, 30)
Dialog.AddButton(1@,2,"{4169E1}", 15, 40, 30, 30 )
Dialog.AddButton(1@,3,"{4169E1}", 45, 40, 30, 30 )
Dialog.AddButton(1@,4,"{4169E1}", 75, 40, 30, 30 )
Dialog.AddButton(1@,5,"{4169E1}", 105, 40, 30, 30 )
Dialog.AddButton(1@,6,"{4169E1}", 135, 40, 30, 30 )
Dialog.AddButton(1@,7,"{4169E1}", 165, 40, 30, 30 )
Dialog.AddButton(1@,8,"{4169E1}", 195, 40, 30, 30 )
Dialog.AddButton(1@,9,"{4169E1}", 225, 40, 30, 30 )
Dialog.AddButton(1@,10,"{4169E1}", 255, 40, 30, 30 )
Dialog.AddButton(1@,11,"{4169E1}", 285, 40, 30, 30 )
Dialog.AddButton(1@,12,"{4169E1}", 15, 75, 30, 30 )
Dialog.AddButton(1@,13,"{4169E1}", 45, 75, 30, 30 )
Dialog.AddButton(1@,14,"{4169E1}", 75, 75, 30, 30 )
Dialog.AddButton(1@,15,"{4169E1}", 105, 75, 30, 30 )
Dialog.AddButton(1@,16,"{4169E1}", 135, 75, 30, 30 )
Dialog.AddButton(1@,17,"{4169E1}", 165, 75, 30, 30 )
Dialog.AddButton(1@,18,"{4169E1}", 195, 75, 30, 30 )
Dialog.AddButton(1@,19,"{4169E1}", 225, 75, 30, 30 )
Dialog.AddButton(1@,20,"{4169E1}", 255, 75, 30, 30 )
Dialog.AddButton(1@,21,"{4169E1}", 285, 75, 30, 30 )
Dialog.AddButton(1@,22,"{4169E1}", 15, 110, 30, 30 )
Dialog.AddButton(1@,23,"{4169E1}", 45, 110, 30, 30 )
Dialog.AddButton(1@,24,"{4169E1}", 75, 110, 30, 30 )
Dialog.AddButton(1@,25,"{4169E1}", 105, 110, 30, 30 )
Dialog.AddButton(1@,26,"{4169E1}", 135, 110, 30, 30 )
Dialog.AddButton(1@,27,"{4169E1}", 165, 110, 30, 30 )
Dialog.AddButton(1@,28,"{4169E1}", 195, 110, 30, 30 )
Dialog.AddButton(1@,29,"{4169E1}", 225, 110, 30, 30 )
Dialog.AddButton(1@,30,"{4169E1}", 255, 110, 30, 30 )
Dialog.AddButton(1@,31,"{4169E1}", 285, 110, 30, 30 )
Dialog.AddStatic(1@,32, "", 35, 140, 600, 30)
Dialog.AddButton(1@,33,"{4169E1}", 15, 170, 130, 30 )
Dialog.AddButton(1@,34,"{4169E1}", 180, 170, 130, 30 )
Dialog.AddButton(1@,35,"{4169E1}", 15, 205, 130, 30 )
Dialog.AddButton(1@,36,"{4169E1}", 180, 205, 130, 30 )
Dialog.AddStatic(1@,37, "{4169E1}", 100, 325, 600, 30)  
Dialog.AddStatic(1@,38, "", 40, 295, 600, 30)  
Dialog.AddStatic(1@,39, "", 90, 235, 600, 30)  
Dialog.AddStatic(1@,40, "", 80, 265, 600, 30)   
0B5A: get_screen_resolution 2@ 3@
3@ /= 2
2@ /=2
2@ +=100
0B84: samp dialog 1@ set_pos_XY 2@ 3@ size 325 380
0B86: samp dialog 1@ set_visible false

while true
wait 0
    if 4@ == 1
    then
    0B8D: samp set_cursor_mode 2
    0B86: samp dialog 1@ set_visible true
        if 0AB0: key_pressed 1
        then
        0B5E: get_cursor_pos 28@ 27@
        0B85: samp dialog 1@ get_position_to 26@ 25@ size_to 0@ 0@
            if and
            001D: 28@ > 26@
            001D: 27@ > 25@ 
            then
            26@ += 340
            25@ += 20
                if and
                001D: 26@ > 28@
                001D: 25@ > 27@ 
                then
                26@ -= 340
                25@ -= 20 
                0062: 28@ -= 26@
                0062: 27@ -= 25@ 
                    while 0AB0: key_pressed 1
                    wait 0
                    0B5E: get_cursor_pos 26@ 25@
                    0062: 26@ -= 28@ 
                    0062: 25@ -= 27@
                    0B84: samp dialog 1@ set_pos_XY 26@ 25@ size 325 380
                    end
                end
            end
        end




Code:
0662: printstring "  " 

:Noname_16
wait 0 
   SAMP.Available
else_jump @Noname_16 
31@ = Render.CreateFont("Tahoma", 10, 5)
call @Noname_8665 1 -8599 

:Noname_61
wait 0 
if 
0ADC:   test_cheat "-" 
else_jump @Noname_163 
if 
   not SAMP.IsCursorActive
else_jump @Noname_132 
018C: play_sound 1083 at 0.0 0.0 0.0 
1@ = 1 
SAMP.ToggleCursor(1)
jump @Noname_163 

:Noname_132
018C: play_sound 1084 at 0.0 0.0 0.0 
1@ = 0 
SAMP.ToggleCursor(0)

:Noname_163
if 
  1@ == 1 
else_jump @Noname_1140 
Render.DrawBorderedBox(1776, 866, 135, 165, -1090519040, 1, -16777216)
Render.DrawBorderedBox(1776, 866, 135, 33, 0, 1, -16777216)
Render.DrawBorderedBox(1776, 899, 135, 33, 0, 1, -16777216)
Render.DrawBorderedBox(1776, 932, 135, 33, 0, 1, -16777216)
Render.DrawBorderedBox(1776, 965, 135, 33, 0, 1, -16777216)
Render.DrawBorderedBox(1776, 998, 135, 33, 0, 1, -16777216)
0AB4: 0@ = var 999 
if 
  0@ == 1 
else_jump @Noname_773 
if 
call @Noname_8464 4 1776 866 135 33 
else_jump @Noname_429 
if 
  2@ == 0 
else_jump @Noname_417 
0DBA: 3@ = new_cleo_thread from_label -5963 
2@ = 1 
jump @Noname_429 

:Noname_417
0DBD:  exit_thread 3@ 
2@ = 0 

:Noname_429
if 
call @Noname_8464 4 1776 899 135 33 
else_jump @Noname_515 
if 
  4@ == 0 
else_jump @Noname_503 
0DBA: 5@ = new_cleo_thread from_label -1147 
4@ = 1 
jump @Noname_515 

:Noname_503
0DBD:  exit_thread 5@ 
4@ = 0 

:Noname_515
if 
call @Noname_8464 4 1776 932 135 33 
else_jump @Noname_601 
if 
  6@ == 0 
else_jump @Noname_589 
0DBA: 7@ = new_cleo_thread from_label -1244 
6@ = 1 
jump @Noname_601 

:Noname_589
0DBD:  exit_thread 7@ 
6@ = 0 

:Noname_601
if 
call @Noname_8464 4 1776 965 135 33 
else_jump @Noname_687 
if 
  8@ == 0 
else_jump @Noname_675 
0DBA: 9@ = new_cleo_thread from_label -3259 
8@ = 1 
jump @Noname_687 

:Noname_675
0DBD:  exit_thread 9@ 
8@ = 0 

:Noname_687
if 
call @Noname_8464 4 1776 998 135 33 
else_jump @Noname_773 
if 
  10@ == 0 
else_jump @Noname_761 
0DBA: 11@ = new_cleo_thread from_label -3459 
10@ = 1 
jump @Noname_773 

:Noname_761
0DBD:  exit_thread 11@ 
10@ = 0


I know that to add an button the variable is Dialog.Add Button(Dialog:Integer, ID:Integer, Caption: String, X:INTEGER, Y:Integer, Width: Integer, Height:Integer)
but what does "Dialog: Integer" and "Id:Integer" do in there ?.


If uou create your buttons on dialog then how to make an jump label so if the courses have pressed and text on dialog the cleo is activated and after pressed again it's deactivated.


(I didn't work with dialogs before, I dont know damn thing about them)

[member=111]springfield[/member]
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
You can create your dialog anywhere in the script, at the end, header, doesn't matter. It's easier to create it at the begining and then set it to be invisible, and make it visible upon activation.

To use Dialog.AddButton you must first create the base dialog.

Dialog.Create(1@,"caption")
Now 1@ is our pointer to this dialog.

Dialog:Integer is your dialog pointer, 1@ in this case.
ID:integer is your control ID for the button.

Dialog.AddButton(1@, 1, "text", X, Y, X, Y) // 1@ = base dialog, 1 = control ID
Dialog.AddEditBox(1@, 2, "bla bla", X, Y, X, Y)
Dialog.AddListBox(1@, 3, X, Y, X, Y)
Dialog.AddSlider(1@, 4, X, Y, X, Y, 300)
etc.

You use the control ID to modifiy things along the way if you want to.

Dialog.SetControlText(1@, 1, "ok")
Dialog.SliderSetValue(1@, 4, 255)

If uou create your buttons on dialog then how to make an jump label so if the courses have pressed and text on dialog the cleo is activated and after pressed again it's deactivated.

I don't understand what you mean.
You can check if a button has been pressed by using
Code:
Dialog.PopEvent(1@, 2@, 3@) //1@ = our base dialog, 2@ = event, 3@ = control ID
if and
 2@ == 257 //0x101 = event for button pressed
 3@ == 1 //button control id
then 
    do stuff
end
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
Thanks....

From what I read something like this should be right, right ?

Code:
{$CLEO}

0000: NOP

:A
wait 0 
if 
0ADC:   test_cheat "TET" 
jf @B
if 
   not SAMP.IsCursorActive
jf @C
1@ = 1 
SAMP.ToggleCursor(1)
goto @B

:B
wait 0
if 
  1@ == 1 
jf @A
Dialog.AddButton(1@, 1, "Infinite Run", 90, 90, 80, 80)

:C
wait 5
1@ = 0 
SAMP.ToggleCursor(0)


:D
wait 0
Dialog.PopEvent(1@, 2@, 3@) 
if and
 2@ == 257
 3@ ==
then 
    0330: set_player $PLAYER_CHAR infinite_run 1
end

and then after this how do you create and label which would set "0330: set_player $PLAYER_CHAR infinite_run" to 0 ?


[member=111]springfield[/member]
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
springfield link said:
Simply make a label then jump to it however you want it.

Yeah, but how to check if the cleo is activated and after mouse press cleo goes off ?

[member=111]springfield[/member]
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
I don't really understand.  :computer_guy:

Dialog.PopEvent(1@, 2@, 3@)
if and
2@ == 257
3@ == controlID
then
    0330: set_player $PLAYER_CHAR infinite_run 1
    0BA4: dialog 1@ free //destroys dialog
   
    or
    0B86: dialog 1@ set_visible 0 //makes dialog invisible, upon activation make it visibile again
end
 
Status
Not open for further replies.
Top