I some of them I'm using same functions that I made, Can I put the function in script and call it from those scripts (on-up/on-down and etc...) ?
This is my useful functions, It's get input and return output... for example:
Code: Select all
:local str "NAME1=TEST1;NAME2=TEST2;NAME3=TEST3"
:set str [$setKeyValue string=[:tostr $str] name="NAME2" value="CHANGED"]
Code: Select all
:local getKeyValue do={
:if ([:type [:find $string $name]]!="nil") do={
:local cut [:pick $string ([:find $string $name]+[:len $name]+1) [:len $string]]
:if ([:len [:find $cut ";"]]>0) do={
:return [:pick $cut 0 [:find $cut ";"]]
} else={
:return [:pick $cut 0 [:len $cut]]
}
} else={
:return ""
}
}
:local setKeyValue do={
:if ([:typeof [:find $string $name]]!="nil") do={
:local current
:local cut [:pick $string ([:find $string $name]) [:len $string]]
:if ([:len [:find $cut ";"]]>0) do={
:set current [:pick $cut 0 [:find $cut ";"]]
} else={
:set current [:pick $cut 0 [:len $cut]]
}
:return ([:pick $string 0 [:find $string $current]]."$name=$value".[:pick $string ([:find $string $current]+[:len $current]) [:len $string]])
} else={
:return ("$name=$value;".$string)
}
}