Strings
I know this may sound silly, but is there any way of storing string values in DinkC? I would like to know, and am willing to further my knowledge of DinkC to understand it!
You can replace every character with a number, and then store them.
*EDIT*I think Quite a few DMODs, like Cast Awakening, can handle strings.
*EDIT*I think Quite a few DMODs, like Cast Awakening, can handle strings.
*EDIT*I think Quite a few DMODs, like Cast Awakening, can handle strings.
It's not like DMODs actually change what DinkC can do. It's just that they manage to use it really ingeniously.
How it can be done:
first method:
I could write the word 'dink' by making a variable for each letter:
int &sign1 = 4;
int &sign2 = 9;
int &sign3 = 14;
int &sign4 = 11;
And then you could figure out what it says using a=1,b=2,c=3 etc.
second method:
You could also try to put all characters in a single variable, like this:
int &sign = 11140904;
This time I did exactly the same except that the first sign is given by the last two digits, the second letter is given by two digits multiplied by 100 and the third is given by two digits multiplied by 10000 (=100^2) and so on, it's really straightforward to see. This approach has a limit of four characters in one variable.
third method:
The limit of four characters can be stretched by taking multiples of 26 instead of 100.
This way 'dink' becomes:
int &word = 203038;
This way there's a maximum of six characters. But it will take a bit more understanding of mathematics to extract the correct word.
It's not like DMODs actually change what DinkC can do. It's just that they manage to use it really ingeniously.
How it can be done:
first method:
I could write the word 'dink' by making a variable for each letter:
int &sign1 = 4;
int &sign2 = 9;
int &sign3 = 14;
int &sign4 = 11;
And then you could figure out what it says using a=1,b=2,c=3 etc.
second method:
You could also try to put all characters in a single variable, like this:
int &sign = 11140904;
This time I did exactly the same except that the first sign is given by the last two digits, the second letter is given by two digits multiplied by 100 and the third is given by two digits multiplied by 10000 (=100^2) and so on, it's really straightforward to see. This approach has a limit of four characters in one variable.
third method:
The limit of four characters can be stretched by taking multiples of 26 instead of 100.
This way 'dink' becomes:
int &word = 203038;
This way there's a maximum of six characters. But it will take a bit more understanding of mathematics to extract the correct word.
In the DMOD I'm planning on, I'm using this technique for storing subquest information.