|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Hello,
How can i do this happens?
[code] alias test { $iif(%TEST,echo -s EXIST THE TEST | return %TEST,echo there is not EXIST) }
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Use an alias in the $iif(). Or put the echoes in the script that calls your alias instead of in the alias.
if $test(whatever) { echo -a exists }
else { echo -a doesn't exist }
Last edited by Riamus2; 07/03/11 10:38 PM.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jul 2006
Posts: 4,149
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,149 |
Use correct syntax/commands, you know, /if. if (%test) {
echo -a % $+ test is different from 0, $false and $null
echo curly bracket let you make bloc of commands
unset %test
}
else {
echo -a % $+ test is either 0, $null, or $false
}
Last edited by Wims; 07/03/11 10:41 PM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
You have to construct the code as follows: alias test {
echo -s $iif(%test,The test exists : $v1,The $+(%,test) variable doesn't exist)
}
alias test {
if (%TEST) {
echo -s THE $+(%,test) exists
echo -s %TEST
}
else {
echo -s the $+(%,test) doesn't EXIST
}
}
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Ok and if i have something like this? how can i change it to work?
alias fkc_check_aliases {
unset %FKC_TEMP
var %a = f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,sf1,sf2,sf3,sf4,sf5,sf6,sf7,sf8,sf9,sf10,sf11,sf12,cf1,cf2,cf3,cf4,cf5,cf6,cf7,cf8,cf9,cf10,cf11,cf12,fkc_crdate,fkc_ver,fkc_owner,fkeys_restore,fkeys-changer,fkeys-changer-settings,fkc_settings,fkc_error,fkc_error_load,fkc_menu,fkc_color,fkc_font,addon,d_min,d_max,d_close,s_close,red,green,fkeys,fkeys_settings,fkc_mdx,fkc_animate,fkc_sclick,fkeys_check_fkeys_on,fkc_about,fkc_download,fkc_download_fail,fkc_remove,fkc_count,fkc_check,fkc_settings_check,fkc_restore,fkeys_load_themes,fkeys_load_fonts,fkc_download_install,fkc_update_fail,fkc_help_unload,fkc_report_bug,fkc_report_suggest,malaka1,malaka2
var %x = 1
while (%x <= $numtok(%a,44)) {
if (!$isalias($gettok(%a,%x,44))) { set -e %FKC_TEMP $addtok(%FKC_TEMP,$gettok(%a,%x,44),32) }
if ((%x == $numtok(%a,44) && (!%FKC_TEMP))) { $iif($isid == $true,return 0,echo -ac info * /fkc_check_aliases: does not missing any alias from the addon - RETURN: $chr(40) $+ $+ 0 $+ $+ $chr(41) $+ ) }
elseif ((%x == $numtok(%a,44) && (%FKC_TEMP))) { $iif($isid == $true,return %FKC_TEMP,echo -ac info * /fkc_check_aliases: missing $iif($numtok(%FKC_TEMP,32) !== 1,$v1 aliases,$iif($numtok(%FKC_TEMP,32) == 1,an alias)) from the addon - RETURN: $chr(40) $+ $+ %FKC_TEMP $+ $+ $chr(41) $+ ) | set %FKC_ERROR MISSING $iif($numtok(%FKC_TEMP,32) == 2,ALIASES,$iif($numtok(%FKC_TEMP,32) == 1,ALIAS)) " $+ %FKC_TEMP $+ " | unset %FKC_TEMP }
inc %x
}
inc %x
}
and i wanna do it like this
alias fkc_check_aliases {
unset %FKC_TEMP
var %a = f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,sf1,sf2,sf3,sf4,sf5,sf6,sf7,sf8,sf9,sf10,sf11,sf12,cf1,cf2,cf3,cf4,cf5,cf6,cf7,cf8,cf9,cf10,cf11,cf12,fkc_crdate,fkc_ver,fkc_owner,fkeys_restore,fkeys-changer,fkeys-changer-settings,fkc_settings,fkc_error,fkc_error_load,fkc_menu,fkc_color,fkc_font,addon,d_min,d_max,d_close,s_close,red,green,fkeys,fkeys_settings,fkc_mdx,fkc_animate,fkc_sclick,fkeys_check_fkeys_on,fkc_about,fkc_download,fkc_download_fail,fkc_remove,fkc_count,fkc_check,fkc_settings_check,fkc_restore,fkeys_load_themes,fkeys_load_fonts,fkc_download_install,fkc_update_fail,fkc_help_unload,fkc_report_bug,fkc_report_suggest,malaka1,malaka2
var %x = 1
while (%x <= $numtok(%a,44)) {
if (!$isalias($gettok(%a,%x,44))) { set -e %FKC_TEMP $addtok(%FKC_TEMP,$gettok(%a,%x,44),32) }
if ((%x == $numtok(%a,44) && (!%FKC_TEMP))) { $iif($isid == $true,return 0,echo -ac info * /fkc_check_aliases: does not missing any alias from the addon - RETURN: $chr(40) $+ $+ 0 $+ $+ $chr(41) $+ ) }
elseif ((%x == $numtok(%a,44) && (%FKC_TEMP))) { $iif($isid == $true,return %FKC_TEMP | set %FKC_ERROR MISSING $iif($numtok(%FKC_TEMP,32) == 2,ALIASES,$iif($numtok(%FKC_TEMP,32) == 1,ALIAS)) " $+ %FKC_TEMP $+ " | unset %FKC_TEMP,echo -ac info * /fkc_check_aliases: missing $iif($numtok(%FKC_TEMP,32) !== 1,$v1 aliases,$iif($numtok(%FKC_TEMP,32) == 1,an alias)) from the addon - RETURN: $chr(40) $+ $+ %FKC_TEMP $+ $+ $chr(41) $+ ) | set %FKC_ERROR MISSING $iif($numtok(%FKC_TEMP,32) == 2,ALIASES,$iif($numtok(%FKC_TEMP,32) == 1,ALIAS)) " $+ %FKC_TEMP $+ " | unset %FKC_TEMP }
inc %x
}
inc %x
}
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
- DELETED - (sorry for second post)
Last edited by westor; 07/03/11 10:44 PM.
|
|
|
|
Joined: Jul 2006
Posts: 4,149
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,149 |
Showing your code isn't needed, you quite clearly showed what you wanted to do with your $iif() example, the solution is to use the proper syntax, /if.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Yes but how ? i don't know how. i tryied with an extra alias but does not return anything.
|
|
|
|
Joined: Jul 2006
Posts: 4,149
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,149 |
$iif isn't mean to execute command but to return something, which is why you can't do multiple "command" with it, it doesn't make sense to talk about command when using $iif, use /if. Side note, an extra alias is a workaround, not the solution, the help file never stated to use $iif with an alias when you want to do more than one command. Yes but how ? i don't know how. i tryied with an extra alias but does not return anything. Yes you do, you just learned that you need to use if, not $iif alias wrong {
$iif(condition, command | command)
}
alias right {
if (condition) {
command
command
}
}
Last edited by Wims; 07/03/11 11:19 PM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Problem solved i have added an alias.
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
$iif() is handy when you make a comparison for a simple true or false, not to be interwoven with the if-then-else condition. Most of the time /if is more efficient than using $iif(). I used to abuse $iif() quit literally, and I've learned it the hard way. You'll learn from your own experience eventually.
|
|
|
|
|