A real-valued function has to output a real number or a vector that is composed only of real numbers.
But can a scalar-valued function or vector-valued function output an imaginary number if it is not also labeled as real-valued?
For example, is this a scalar valued function?
$$ f:x \mapsto x\sqrt{-1} $$
A general truth in mathematics is that functions do not exist independently from their domain and codomain. This is a misconception generated by those pre-calc problems where they asked you to "find the domain" of a certain formula. So $f$ by itself (the "mapping rule") is not a function; $f : A \to B$, instead, is. Therefore, you need to specify what $A$ and $B$ are when defining a function.
Real numbers live in $\mathbb R$. Real euclidean vectors live in $\mathbb R^n$ for some $n$. A function from $f : \mathbb R \to \mathbb R$ is called real(-valued) function of one real variable. A function $f : \mathbb R \to \mathbb R^n$ is called vector(-valued) function of one real variable. A function $f : \mathbb R^k \to \mathbb R$ is called a real(-valued) function of $k$ real variables. Just guess what functions like $f : \mathbb R^k \to \mathbb R^n$ are.
In the context of real vector spaces, and in particular $\mathbb R^n$, scalars are the elements of the base field of the vector space. In the case of $\mathbb R^n$, that field is most naturally $\mathbb R$. So any time you find "real(-valued)" in the above nomenclatures, you may substitute scalar(-valued).
As you know, the imaginary unit $i$ is not in $\mathbb R$, so the function you proposed (wherever your $x$ comes from) may never be of the kinds listed above. However, if $x$ came from $\mathbb C$ or $\mathbb C^n$, the map $x \mapsto ix$ would not be such a strange sight.