Trying to make a string lowercase using *script [SOLVED, can't use *script in CSIDE]

Got a bit of a technical question. I have a string variable that I want to make completely lowercase. There’s an old thread for this question involving the *script command, but I can’t seem to get the solution working. In fact, I can’t seem to get the *script command working at all.

My first attempt looked roughly like this:

*temp var1 “AAAAAA”

*temp var2 var1

*script temps.var2 = temps.var2.toLowerCase()

${var2}

The output to this would be:

AAAAAA

when the expected output is:

aaaaaa

And then I tried to simplify things and just tried to set var2 to any kind of string.

*temp var1 “AAAAAA”

*temp var2 var1

*script temps.var2 = “aaaaaa”

${var2}

Same results. No errors, but not what I was expecting. Am I missing something? Or has ChoiceScript changed since that thread five years ago?

1 Like

What exactly are you trying to do? Because you can set a string as lowercase already and without the use of *script

*create var1 “hello”

${var1}

Would show as hello.

Likewise $!{var1}

Would show as Hello.

The ! capitalize the first letter, but otherwise the string remains the same.

The *script command is desabled in CSIDE. I don’t know if you’re using it. This could the reason.

5 Likes

I don’t have the answer to the specific question, however, can’t you define the variable in lowercase? Because it’s easy to capitalize the entire content of a string variable on demand. You just need two exclamation marks.

*temp var1 "aaa"
$!!{var1}

the output would be AAA

2 Likes

Yeah that’s right but the point is a string can be set as lowercase so I’m not sure what the topic creator is actually after.

That could be useful for user input. I’ve wondered how to turn to lower case myself.

1 Like

when using strings you can automatically set it as lowercase.

*set weapon “sword”

should print it as lowercase

I was using CSIDE. It worked perfectly once I ran it in browser. Very interesting, thank you.

2 Likes