Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Saving commas in strings (https://forums.graalonline.com/forums/showthread.php?t=43189)

HoudiniMan 03-03-2003 05:48 PM

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?

Jeff 03-03-2003 06:12 PM

Just like any other string

HoudiniMan 03-03-2003 06:13 PM

Quote:

Originally posted by Jeff
Just like any other string
You can't honestly think that helped any.

Jeff 03-03-2003 06:16 PM

Quote:

Originally posted by HoudiniMan


You can't honestly think that helped any.


Okay then. You'd probably use setstring.

Neoreno 03-03-2003 06:17 PM

Try putting quotes around it.

HoudiniMan 03-03-2003 07:03 PM

I'll try quotations i suppose

Jeff 03-03-2003 09:11 PM

If you are using string arrays, then I'd suggest a preprocessor to remove or replace commas.

osrs 03-03-2003 10:54 PM

I don't understand what you mean,but addstring wouldn't help?
if there is a string like 'client.chatmsg',would work. ^_^'

Dach 03-04-2003 12:18 AM

Quote:

Originally posted by osrs
I don't understand what you mean,but addstring wouldn't help?
if there is a string like 'client.chatmsg',would work. ^_^'

your post befuzzles me, are you talking about #c?

Knuckles 03-04-2003 12:54 AM

Quotation marks should work.

osrs 03-04-2003 01:28 AM

Quote:

Originally posted by Dach


your post befuzzles me, are you talking about #c?

like,you make a system to display the text ,then you use addstring to add a message into the system.

something like this..

NPC Code:

if(playerenters){
addstring client.chatmsg,Welcome to my level #n;
}



But i don't know what exactly he needs..

PrinceDark 03-04-2003 02:05 AM

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.

Jeff 03-04-2003 05:36 AM

Quote:

Originally posted by Kaimetsu
As I understand it, the problem is not in getting the commas into the string; it's more an issue of getting #I to interpret the string array properly. Or maybe Graal's crazy about commas in other contexts too, I dunno.

As I said, a replacement-based preprocessor to substitute an ampersand, a semicolon, a period, or any other non-comma symbol.

PrinceDark 03-04-2003 06:49 AM

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.