Code: Select all
global test yes
/log info [:typeof $test]
/log info [:typeof yes]
/log info ( yes = yes )
/log info ( $test = yes )
global print do={
if ( $test = yes) do={/log info yes} else={/log info no}
}
$print
global test no
$print
global test yes
/log info [:typeof $test]
/log info [:typeof yes]
/log info ( yes = yes )
/log info ( $test = yes )
global print do={
if ( $test = yes) do={/log info yes} else={/log info no}
}
$print
global test no
$print
Any details? Because my "details" work fine...It's not working in scripts with log
Declare a global variable before use in function!It's not working in scripts with log. if i did it in terminal it's work perfect.
Will not work, you need to double quote yes like this:if ( $test = yes) do={/log info yes} else={/log info no}
if ( $test = "yes") do={/log info "yes"} else={/log info "no"}
:global test "yes"
[
:global test
if ( $test = "yes") do={:put "true"} else={:put "false"}
]
:global test "no"
[
:global test
if ( $test = "yes") do={:put "true"} else={:put "false"}
]
it's string not bool! I'm write about bool's in scripts!Will not work, you need to double quote yes like this:Code: Select allif ( $test = "yes") do={/log info "yes"} else={/log info "no"}
@cmdorexeSo what's exactly not working?
:local test "more"
:put $test
{
:local test "more"
:put $test
}
[
:local test "more"
:put $test
]
:global test yes
:global print do={
:global test
if ( $test = yes) do={/log info yes} else={/log info no}
}
$print
:global test no
$print
:global test yes
:global print do={
if ( $test = yes) do={/log info yes} else={/log info no}
}
$print test=$test
:global test no
$print test=$test
wow n1ce trick. I never known.Or you can pass the var into function explicitly: