I Think I solved the kind of Data Problem!
Here is a link with a working example of my solution. By using this handler. My code can always identify with precsion(ish) the exact kind of Data you typed in the console.
Hmm. Apparently ChoiceScript recognizes everything as a sequence of chars, even numbers. .
Now I will work in a way to convert any variable value into a string! (And vice-versa)
Now, the code:
Checking the input:
*label check_input
*params this_value
*comment now check value input
*comment is boolean?
*if (this_value = true) or (this_value = false)
*set kind_of_data "BOOLEAN"
*page_break END OF TEST! ${this_value} Is a boolean
*return
*comment is number?
*gosub is_number (this_value) "truth" "this_value"
*if truth
*set kind_of_data "NUMBER"
*page_break END OF TEST! ${this_value} Is a number
*return
*comment is string?
*comment This is a String
*set kind_of_data "STRING"
*page_break END OF TEST! ${this_value} is a String
*return
Check Input:
Check if is a number (Now working with negatives and decimals!)
*comment === FUNCTION IS_NUMBER =========
*comment ------------------------------
*comment Determines if a given string is a number.
*comment ------------------------------
*comment params:
*comment mystring(string): the value to test
*comment
*comment retrieve(address string): the name (address)
*comment of the variable to receive the return.
*comment ------------------------------
*comment returns:
*comment (retrieve) true if p_string is a number, else
*comment false
*comment
*comment return(address): optional returning for
*comment numbers of negligible values.
*comment =======================
*comment Auxiliary IS _THIS A NUMBER?? ==
*comment =======================
*comment *gosub is_number (string) (return)
*label is_number
*params mystring retrieve
*temp isnumber true
*temp sanitized ""
*temp p_address "void"
*temp count_param (param_count)
*temp point 0
*temp i 0
*temp j 1
*if count_param > 2
*set p_address param_3
*goto continue_is_number
*label continue_is_number
*comment checking if negative
*if (("${mystring#1}" = ("-")) and ((length(mystring)>1)))
*set sanitized "-"
*set j+1
*goto For_is_number
*label For_is_number
*comment For (i=0; i<10; i++)
*comment For (j=1; j<length(param_1); j++)
*if (j <= (length(mystring)))
*if isnumber
*comment check if number 4 sure
*goto For_is_number_j
*else
*comment NOT a NUMBER!
*set {retrieve} false
*return
*else
*comment NOT A NUMBER!
*set {retrieve} false
*return
*label For_is_number_j
*if i < 10
*if ("${mystring#j}" = ("${i}"))
*comment DEBUG: FOUND NUMBER i ${i} at J ${j} in "${mystring#j}"
*set sanitized (sanitized&("${i}"))
*set j +1
*set i 0
*if j > (length(mystring))
*comment the string IS A NUMBER!
*set {retrieve} true
*return
*comment lets check next char in da string
*goto For_is_number
*if ("${mystring#j}" != ("${i}"))
*comment lets compare with 1 to 9.
*set i +1
*goto For_is_number_j
*if ("${mystring#j}" = ("."))
*set point +1
*if (j = (length(mystring)))
*set isnumber false
*set {retrieve} false
*return
*if ((("${mystring#(j+1)}") = "0") and ((j+2) > (length(mystring))))
*set {p_address} (sanitized)
*set {retrieve} true
*return
*if (((("${mystring#(j+1)}") = "0") and (("${mystring#(j+2)}") = "0")))
*set {p_address} (sanitized)
*set {retrieve} true
*return
*if point > 1
*set isnumber false
*set {retrieve} false
*return
*else
*set sanitized (sanitized&("."))
*set j +1
*set i 0
*goto For_is_number
*else
*comment NOT a NUMBER!
*set isnumber false
*set {retrieve} false
*return