Variable question
Is it possible to do something like this:
&var = Hello
So if you do something like this:
say_stop("&var!", 1);
It will appear something like this:
Dink: Hello!
&var = Hello
So if you do something like this:
say_stop("&var!", 1);
It will appear something like this:
Dink: Hello!
See my post here on how to store a string in an integer.
So, if I do this:
int &txt1 = H
int &txt2 = e
int &txt3 = l
int &txt4 = o
say_stop("&txt1&txt2&txt3&txt3&txt4!", 1);
Dink will say "Hello!"?
int &txt1 = H
int &txt2 = e
int &txt3 = l
int &txt4 = o
say_stop("&txt1&txt2&txt3&txt3&txt4!", 1);
Dink will say "Hello!"?
The short answer: No, you can't. Variables only store numbers.
The long answer: No, you can't. You can store strings in variables by encoding them as numbers (a = 1, b = 2, c = 3, etc...), but there's no way to get back to the string.
If it were possible to store strings in variables, and use them as strings, then I'd like to hear about it. Especially if they'd be usable in things like external(), because that'd rock.
The long answer: No, you can't. You can store strings in variables by encoding them as numbers (a = 1, b = 2, c = 3, etc...), but there's no way to get back to the string.
If it were possible to store strings in variables, and use them as strings, then I'd like to hear about it. Especially if they'd be usable in things like external(), because that'd rock.

Oh well. See, I was thinking about having a D-Mod where you can have your own customizable character, with a customizable name, and the name would be stored in &name or something. But it doesn't matter. Too much effort, anyway.
It's very possible to get them back to strings. You just need to display one character at a time. So it's easier with a font where very character is the same width.
Make an exteral("something","say_str_xy",var,x,y) type function like this:
int &x = &arg2;
int &ntimes = 0;
loop:
//extract next letter from &arg1
if (&letter == 0) say_xy("A",&x,&arg3);
//etc
&x += <width of chars>;
&ntimes += 1;
if (&ntimes <= 6)
goto loop;
Because you can't pass strings in an external() nor determine the number of characters in a string you need to work out the x and y's if you wanted to have text on each side of the string (e.g. "Hi there, &name! How are you? is possible with an say_xy for "Hi there, " and one for "! How are you?" but you need to calculate the x/y yourself which isn't too hard but annoying if you want to do it a lot)
Make an exteral("something","say_str_xy",var,x,y) type function like this:
int &x = &arg2;
int &ntimes = 0;
loop:
//extract next letter from &arg1
if (&letter == 0) say_xy("A",&x,&arg3);
//etc
&x += <width of chars>;
&ntimes += 1;
if (&ntimes <= 6)
goto loop;
Because you can't pass strings in an external() nor determine the number of characters in a string you need to work out the x and y's if you wanted to have text on each side of the string (e.g. "Hi there, &name! How are you? is possible with an say_xy for "Hi there, " and one for "! How are you?" but you need to calculate the x/y yourself which isn't too hard but annoying if you want to do it a lot)