CLEO Help Need simple help with sannyBuilder

CLEO related
Status
Not open for further replies.

MichaelScott

Member
Joined
Apr 29, 2019
Messages
15
Reaction score
0
Hello, I have just started learning to script with SannyBuilder and i ran into some problems that i can't find any fixes to it. Here is the code:
Code:
{$CLEO .cs}

0000: NOP

thread 'snippet'

:label_1
wait 0
if 0AB0: key_pressed 106
then 0AF9: "/fish"
    0AD1: show_text "Started fishing" time_in_ms 2000
    wait 1000
    jump @label_1
else jump @label_1
end

First of all, whenever i press the multiply button - *, it should write command /fish in chat, but instead i get error in chat: Exception 0x000005 0x0, something like that.
Also, I can't find how to make the cleo script press any button, because I will need it later. For example it should spam ENTER button for 5 seconds.
Any help is appreciated.
 

MichaelScott

Member
Joined
Apr 29, 2019
Messages
15
Reaction score
0
I don't get it, i know it should compare the game text with some kind of string, but it doesnt make sense to me. Also i dont think i need the first label at all, because i'm doing it a bit different. I just dont get that comparison part
 

MichaelScott

Member
Joined
Apr 29, 2019
Messages
15
Reaction score
0
Alright, i know that this code will be messed up as hell, but it is what i managed to do, sorry for making you fix it.
Code:
{$CLEO .cs}
{$INCLUDE SF}

0000: NOP


:label_1
wait 0
if 0AB0: key_pressed 106
then 0AF9: "/zvejoti"                                          
    0AD1: show_text "Pradeta Zvejoti" time_in_ms 2000
    wait 1000
    jump @IncomingRPC
else jump @label_1
end      

:IncomingRPC
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
if
0@ == RPC_SCRDISPLAYGAMETEXT // GameText
then
    5@=0
    0BE5: raknet 1@ = get_hook_param PARAM_BITSTREAM
    //ignore gamtext style and time (8bytes = 64bits)
    0BEB: raknet bit_stream 1@ ignore_bits 64
    //read text length                                  
    0BE7: raknet 2@ = bit_stream_read 1@ type BS_TYPE_INT
    //allocate text length + 1 for null terminating char  
    0A8E: 3@ = 2@ + 1
    alloc 4@ = 3@
    //clear buffer, make sure last char is 0
    0C11: memset 4@ value 0 size 3@
    //read to buffer with size
    0BE8: raknet bit_stream 1@ read_array 4@ size 2@
    chatmsg "GameText: %s" -1 4@
    if
    0C14: strcmp string1 4@ string2 "JUMS UZKIBO LAIMIKIS SPAUDINEKITE ENTER"
    then
        0AF8: "Pradedama gaudyti" 1
        while 5@>15
            0B56: set_game_key 13 state 0xFF
            wait 500
            0B56: set_game_key 13 state 0
            5@+=1
            end
    else jump @IncomingRPC
    end    
    free 4@
end
0BE0: raknet hook_ret true
end
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,159
Solutions
5
Reaction score
894
Location
Lithuania
PHP:
{$CLEO .cs}
{$INCLUDE SF}
 
0000: NOP
 
0BE3: raknet setup_incoming_rpc_hook @IncomingRPC
30@ = 0
31@ = 0
29@ = 0

:main
end      
wait 0
if and
key_down 49 // 1
key_down 74 // J
then
    if
    31@ == 0
    then
        31@ = 1
        0AF8: "{FFFFFF}Fisher: {00FF33}Enabled" 1
    else
        31@ = 0
        0AF8: "{FFFFFF}Fisher: {FF0000}Disabled" 1
    end
    wait 1000
end
if
30@ == 1
then
    if
    31@ == 1
    then
        10@ = 1 // send access to key press
        30@ = 0
        29@ = 0
    else
        31@ = 0
        30@ = 0
    end
end

if
0AB0: 106
then
    repeat
    wait 0
    until 8ab0: 106
    say "/zvejoti"
end

if
10@ == 1
then
    0AB1: @Set_Virtual_Key 2 KeyOffSet 0x0D state 255
    wait 100
    0AB1: @Set_Virtual_Key 2 KeyOffSet 0x0D state 0
    1@ += 1
    if
    1@ >= 10
    then
        10@ = 0  // stop send key after 10 times...
    end
end
    
jump @main
 
:IncomingRPC
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
if and
0@ == RPC_SCRDISPLAYGAMETEXT // GameText
31@ == 1
29@ == 0
then
    0BE5: raknet 1@ = get_hook_param PARAM_BITSTREAM
    //ignore gamtext style and time (8bytes = 64bits)
    0BEB: raknet bit_stream 1@ ignore_bits 64
    //read text length                                    
    0BE7: raknet 2@ = bit_stream_read 1@ type BS_TYPE_INT 
    //allocate text length + 1 for null terminating char   
    0A8E: 3@ = 2@ + 1 
    alloc 4@ = 3@ 
    //clear buffer, make sure last char is 0
    0C11: memset 4@ value 0 size 3@ 
    //read to buffer with size
    0BE8: raknet bit_stream 1@ read_array 4@ size 2@ 
    //chatmsg "GameText: %s" -1 4@
    if
    0C29: $NOT_USED = stristr string1 4@ string2 "JUMS UZKIBO LAIMIKIS SPAUDINEKITE ENTER"
    then
        30@ = 1
        29@ = 1
    end    
    free 4@
end
0BE0: raknet hook_ret true

:Set_Virtual_Key
{
    255 = true
    0 = false
    0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 255
}
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0
 
Status
Not open for further replies.
Top