LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Converting Types pls

Root / Programming Questions / [.]

computableeCreated:
How to convert a value to a string/int/real no matter its type? For example, if I do
STR$("test")
There's a type mismatch because STR$ is not meant to take values other than int or real. I need to find a workaround to this issue. If you are wondering what I need this for, I'm creating an object type in Nossrec, my SmileBasic Precompiler (I'm not calling it PerssonBasic anymore because it's no longer basic by any means).

I know that you probably know about this already, but just in case you don't: http://smilebasicsource.com/page?pid=51 Other than that, I can't really think of anything. And it doesn't know what to do with arrays.

Okay, I have this working now. Thank you.

New question: How to assign a string value to a variable without passing parameters of incorrect type? Layman's Terms: If you do this
DEF A B
 ?B
END
A "hi"
You get "hi" as an output even though B does not have the string suffix, because when "hi" was assigned to B, its type wasn't checked. I need to do something like this, except without using this exploit. I've tried using FUNCTION% OUT STRING$, but that doesn't seem to work. I know assigning a variable via = is type-checked. I'm trying to think of other ways to do this.

New question: How to assign a string value to a variable without passing parameters of incorrect type? Layman's Terms: If you do this
DEF A B
 ?B
END
A "hi"
You get "hi" as an output even though B does not have the string suffix, because when "hi" was assigned to B, its type wasn't checked. I need to do something like this, except without using this exploit. I've tried using FUNCTION% OUT STRING$, but that doesn't seem to work. I know assigning a variable via = is type-checked. I'm trying to think of other ways to do this.
... What do you want to do?

I wanted to assign a string value to a variable without passing parameters of incorrect type, but I've found another way to do it without incorrect type passing.

I think he meant that in a higher level - why do you want to do that? I can't imagine a situation where you would need this.

The way "to assign a string value to a variable without passing parameters of incorrect type" is to use the $ suffix on the variable name.

The way "to assign a string value to a variable without passing parameters of incorrect type" is to use the $ suffix on the variable name.
I meant without using the $ suffix. I am very educated on SmileBasic and how the majority of it works. That's why I was trying to exploit some stuff because I didn't like how it worked.