![]() |
Saving commas in strings
Pretty self-explanatory...
Say you had a chat system and had a string representing a message that would be displayed. If you wanted a way to set the string so that if you typed a message with a comma it would save as a comma inside the string, how would you do it? |
Just like any other string
|
Quote:
|
Quote:
Okay then. You'd probably use setstring. |
Try putting quotes around it.
|
I'll try quotations i suppose
|
If you are using string arrays, then I'd suggest a preprocessor to remove or replace commas.
|
I don't understand what you mean,but addstring wouldn't help?
if there is a string like 'client.chatmsg',would work. ^_^' |
Quote:
|
Quotation marks should work.
|
Quote:
something like this.. NPC Code: But i don't know what exactly he needs.. |
I did a npc before that stores messages once. I used
#T(#e(startindex,length,str)) for a part of it. You could try that and I believe it will keep the commas there. |
Quote:
As I said, a replacement-based preprocessor to substitute an ampersand, a semicolon, a period, or any other non-comma symbol. |
I checked my npc and yeah what it did for the string list is when I had the strings set like setstring stringname,#T(#e(startindex,length,str)); it took all the words that the player chats and surrounds them with quotation marks. So in the other parts that had addstring and so on it did the same.
So in the flag list it would show client.text="Anyways, blah blah blah","and, if blah blah blah" There wasn't a need for adding the quotations since it automatically did it. Hope that helps you out with whatever you're working on. |
| All times are GMT +2. The time now is 01:43 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.