I'm looking to do two different things: one complicated, the other simple.
The simple one is just being able to convert an int to a char in ASCII fashion, and then put that char in a string.
The other is being able to parse user text input, letter by letter, and then run logic on that input (being able to specifically recognize every letter is important)
Both of these operations are really really easy in C, but this editors lack of string dereferencing and seemingly no char type to speak of makes that difficult. This API Docs here suggest that a char type does exist in the scripting language only, but I don't know how to make that char into a string.
Since there are no pointers avaiable to GS (Galaxy Script) users, c-style strings are out. You want to parse an int to it's ASCII character? I'm willing to bet there's no built-in functionality for that... probably gonna have to do it the old fashioned way (enumerations are your friend in this case, but you'll probably have to build that too :-P )
As for being able to parse user text input, you can get their chat msg with Event: Chat Message, but you'll need an identifier to trigger the event (It looks for specific strings and does not detect "any" message a player enters, although there may be a way to do that I do not know of). So make something like "player: any, inputs: "-" matching: partially" and then the player just has to type a hyphen before any "command"
As for parsing through the string. there are a lot of conversions in functions-conversions. Look for what you need in there, get your substrings, and parse out your strings. reminds me of old C + + assignments...
I bit the bullet and just hardcoded my characters into an array of strings =P So I just do a lookup using that array.
And thanks for point me to Event: Chat Message. Writing the parser will be just like an old C assignment, haha. I should try to look up my code from when I wrote one for class.
I bit the bullet and just hardcoded my characters into an array of strings =P So I just do a lookup using that array.
I'm currently working on a Library containing (amog other things) Functions for Conversion between a single Character String and Integer...
But it seems I was a little bit too slow. :(
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm looking to do two different things: one complicated, the other simple.
The simple one is just being able to convert an int to a char in ASCII fashion, and then put that char in a string.
The other is being able to parse user text input, letter by letter, and then run logic on that input (being able to specifically recognize every letter is important)
Both of these operations are really really easy in C, but this editors lack of string dereferencing and seemingly no char type to speak of makes that difficult. This API Docs here suggest that a char type does exist in the scripting language only, but I don't know how to make that char into a string.
Thanks for any help!
Since there are no pointers avaiable to GS (Galaxy Script) users, c-style strings are out. You want to parse an int to it's ASCII character? I'm willing to bet there's no built-in functionality for that... probably gonna have to do it the old fashioned way (enumerations are your friend in this case, but you'll probably have to build that too :-P )
As for being able to parse user text input, you can get their chat msg with Event: Chat Message, but you'll need an identifier to trigger the event (It looks for specific strings and does not detect "any" message a player enters, although there may be a way to do that I do not know of). So make something like "player: any, inputs: "-" matching: partially" and then the player just has to type a hyphen before any "command"
As for parsing through the string. there are a lot of conversions in functions-conversions. Look for what you need in there, get your substrings, and parse out your strings. reminds me of old C + + assignments...
Thanks a lot for the advice!
I bit the bullet and just hardcoded my characters into an array of strings =P So I just do a lookup using that array.
And thanks for point me to Event: Chat Message. Writing the parser will be just like an old C assignment, haha. I should try to look up my code from when I wrote one for class.
I'm currently working on a Library containing (amog other things) Functions for Conversion between a single Character String and Integer...
But it seems I was a little bit too slow. :(