Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirrored SCM Function opcodes fixes from CLEO5. #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MiranDMC
Copy link
Contributor

Added opcodes 2002 and 2003.

Test script:

{$CLEO .cs}
nop

{$OPCODE 2002=-1, cleo_return_with }
{$OPCODE 2003=-1, cleo_return_fail }

while true
    1@ = 0
    cleo_call @SUM {numArgs} 2 {args} 2 3 {result} 1@
    if
        1@ == 5
    then
        print_formatted_now "~g~2 + 3 = %d" {time} 1000 {arg} 1@
    else
        print_formatted_now "~r~2 + 3 = %d" {time} 5000 {arg} 1@
        wait 5000
    end
    wait 1000
    
    if
        cleo_call @PASS_TRUE
    then
        print_formatted_now "~g~PASS TRUE ok" {time} 1000
    else
        print_formatted_now "~r~PASS TRUE failed" {time} 5000
        wait 5000
    end
    wait 1000
    
    if
        cleo_call @PASS_FALSE
    then
        print_formatted_now "~r~PASS FALSE failed" {time} 5000
        wait 5000
    else
        print_formatted_now "~g~PASS FALSE ok" {time} 1000
    end
    wait 1000
    
    if
        not cleo_call @PASS_TRUE
    then
        print_formatted_now "~r~negation failed" {time} 5000
        wait 5000
    else
        print_formatted_now "~g~negation ok" {time} 1000
    end
    wait 1000
    
    cleo_call @COMBINE {numArgs} 0 {result} 1@
    if
        1@ == 1
    then
        print_formatted_now "~g~COMBINE ok" {time} 1000
    else
        print_formatted_now "~r~COMBINE failed" {time} 5000
        wait 5000
    end
    wait 1000
    
    if and
        cleo_call @RET_WITH_TRUE {numArgs} 0 {result} 1@ 2@
        1@ == 5
        2@ == 6
    then
        print_formatted_now "~g~RET WITH TRUE ok" {time} 1000
    else
        print_formatted_now "~r~RET WITH TRUE failed %d %d" {time} 5000 {args} 1@ 2@
        wait 5000
    end
    wait 1000
    
    if and
        not cleo_call @RET_WITH_FALSE {numArgs} 0 {result} 1@ 2@
        1@ == 5
        2@ == 6
    then
        print_formatted_now "~g~RET WITH FALSE ok" {time} 1000
    else
        print_formatted_now "~r~RET WITH FALSE failed %d %d" {time} 5000 {args} 1@ 2@
        wait 5000
    end
    wait 1000
    
    1@ = 7
    2@ = 8
    if and
        not cleo_call @RET_FAIL {numArgs} 0 {result} 1@ 2@
        1@ == 7
        2@ == 8
    then
        print_formatted_now "~g~RET FAIL ok" {time} 1000
    else
        print_formatted_now "~r~RET FAIL failed %d %d" {time} 5000 {args} 1@ 2@
        wait 5000
    end
    wait 1000
end

terminate_this_custom_script


:FUNC
cleo_return {numArgs} 4 {args} TIMERA 444 23 TIMERB


:SUM
    005A: 0@ += 1@
cleo_return {numArgs} 1 {args} 0@


:PASS_TRUE
    return_true
cleo_return


:PASS_FALSE
    return_false
cleo_return


:COMBINE
    if and
        cleo_call @PASS_TRUE
        not cleo_call @PASS_FALSE
    then
        0@ = 1
    else
        0@ = 2
    end 
cleo_return 1 0@


:RET_WITH_TRUE
2002: {cleo_return_with} true {args} 5 6


:RET_WITH_FALSE
2002: {cleo_return_with} false {args} 5 6


:RET_FAIL
2003: {cleo_return_fail}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant