|
dskorren Novice
Joined: 07 Feb 2002 Posts: 48 Location: Philippines
|
Posted: Sat Jan 04, 2003 12:42 pm
how to store special char in a list |
im trying to store all the special char (punctuations) in a list so i can %replace it with a colored one. im trying to make an alias that will color the special char differently from the words in the sentence. i tried to prefix all of them with tilda but i cant store (, ), and |. thanks
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat Jan 04, 2003 12:47 pm |
Without knowing much about what you already do have and how you are doing it, the best I can suggest is to enclose arguments in double quotes or curly braces (depending on what type they are - %n, variable, text, etc.) and to use %quote.
Kjata |
|
|
|
dskorren Novice
Joined: 07 Feb 2002 Posts: 48 Location: Philippines
|
Posted: Sun Jan 05, 2003 2:16 am |
using "" to enclose the special char works, but i cant store "|". it would result to 2 lines with no value.
#var @spchar {"("|")"|"|"|"-"|"="}
#forall @spchar #show %i
"("
")"
"
"
"-"
"="
adding a tilda to the pipe char would result to:
"("
")"
"~
"
"-"
"="
anyway, if anybody would like to help me store all the symbols `~!@#$%^&*()-_=+|{[}]:;"'<,>.?/ in a list and make it print one char per line with #forall and #show, i would appreciate it a lot. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Jan 05, 2003 3:16 pm |
I'm guessing that you are using 6.16. The good news is that in 6.40, there is no problem with the | character and it displays fine. The bad news is that now the parenthesis don't work.
Since these characters are used internally to store items in stringlists, there is no way to make zMUD interpret them in another way when inside a stringlist. However, since arrays don't work like this, you can use an array instead:
#VAR spchar %array("(", ")", "|", "-", "=")
#LOOP 0,%arrhigh(spchar) {#SH %arrget(spchar, %i)}
Kjata |
|
|
|
dskorren Novice
Joined: 07 Feb 2002 Posts: 48 Location: Philippines
|
Posted: Sun Jan 05, 2003 4:03 pm |
thanks Kjata, storing the special chars using stringlist is really mind boggling, lol, thanks for the info about arrays.
----
one more thing, how do i add the " (qoute) and , (comma) in the array?
----
edited: entered all the values using the editor, and it works fine now. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|