Jump to content

Detecting alphabetic characters


Gabryel Nyoki
 Share

You are about to reply to a thread that has been inactive for 1961 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi,

is there away to detect if a character in a string is alphabetic or not?

For instance, say a display name has those fancy letters, and we want to unformat and just print the normal alphabetic font from the viewer in an llOwnerSay for example. is it possible to detect that this fancy letters are actually letters?

 

Example small caps fancy letters in a display name:

ɢᴀʙʀɪᴇʟ ᴅᴀ sɪʟᴠᴀ

And now i want the substring to find and tell me they are indeed alphabetic.

Haven't been able to find a solution :)

Link to comment
Share on other sites

Try defining

string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

Then when you want to know if a letter is alphabetic, ask:

integer iAlpha = llSubstringIndex(Alphabet,strCharacterToTest);

if (iAlpha != -1)

{

    //We have a winner!

}

Link to comment
Share on other sites

6 hours ago, Gabryel Nyoki said:

Example small caps fancy letters in a display name:

ɢᴀʙʀɪᴇʟ ᴅᴀ sɪʟᴠᴀ

And now i want the substring to find and tell me they are indeed alphabetic.

The way you ask this suggests you are not really looking for alphanumeric detection, but more for letter-like detection. The string to search against would be

"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘʀsᴛᴜᴠᴡʏʏᴢ"

Using the script Rolig correctly lists above.

But your lookup table is also going to need every unicode character that remotely looks like a letter. Sadly, there are some real tortuous combinations out there as well as the readable ones like your small-caps.

As an example: ??????? ?? ????? is quite possible in SL, as is  ɐʌןıS ɐp ןǝıɹqɐƃ and Ⓖⓐⓑⓡⓘⓔⓛ ⓓⓐ Ⓢⓘⓛⓥⓐ

Edited by Callum Meriman
Made Unicode Red
Link to comment
Share on other sites

4 hours ago, Callum Meriman said:

The string to search against would be..

But just checking if it's "like" a normal character isn't enough, since..

10 hours ago, Gabryel Nyoki said:

print the normal alphabetic font

This makes it much more complicated, since you'll need multiple strings or lists to be able to tell which character to convert to.

So, there is a way, but it isn't something simple.

Link to comment
Share on other sites

Thank you for your replies

1 hour ago, Phate Shepherd said:

I am curious, what is your intent? Is it to feed the result to an in-world text display?

Something like that yes!

 

On 10/9/2018 at 11:56 PM, Lucia Nightfire said:

You might have to involve a website that can use Python's Unidecode command or whatever other language's equivalent.

Could you elaborate?

Link to comment
Share on other sites

  • 1 month later...
3 minutes ago, Rolig Loon said:

At any Premium gift kiosk.  That is how all Premium gifts are distributed.

To get your premium virtual good, go to one of the inworld vending kiosks listed in the Second Life Destination Guide: http://secondlife.com/destinations/premium/gifts.

Oh thank you so much I will check! So you mind if I message you directly?

 

Link to comment
Share on other sites

33 minutes ago, Rolig Loon said:

If you have a scripting question, it is always best to ask here in the forum, so that other people have an opportunity to add information and so that other people who might be interested in the topic can read the discussion.

no, was about the premium gift, seems I have not paid attention to the gifts they are giving people to justify the completely useless viewer they provide with no development.

1 minute ago, Phate Shepherd said:

Are you still trying to see if a character is alphabetic, or are you wanting to do substitution, or what do you have in mind?

I quit trying :( there's so many combinations of things people do that I think it's impossible...

Link to comment
Share on other sites

from a coding pov then is possible to do a character translator app fairly easily.  Whats not easy is getting the translation 100% correct in every instance. But I think it would be possible to achieve +90%. The more rules coded/catered for then the closer to 100% we can get

a thing is that the Change Display Name box doesn't accept all characters. It seems that it only accepts Unicode 16 - 2 byte characters. The extended 3 byte character set it doesn't. Am not sure if this is absolutely true but I do know that some characters it does not accept and I think its the 3 byte characters. Somebody reading might be able to shed further light on this

putting this aside for now. A way to do this is something like:

list alphabet = ["Aa", "Bb", ... "Zz"];  where the list contains 26 strings of symbols. List element 0 = "Symbols that can be used as A". List element 1 = "Symbols that can be used as B". Etc etc. upto List element 25 = "Symbols that can be used as Z"

parse the DisplayName, 1 symbol at a time, look up the symbol in alphabet then assign it to "a", "b", "c" etc.  Assigning "A", "B", etc when used literally in the parsed string

then start adding rules. Which can include:

- further capitalisation of words made of symbols
- when a word contains all upside down symbols then reverse the output
- when a symbol is not found in alphabet then output it verbatim. Or substitute a symbol for unknown. A space, dot or whichever
- when a symbol is a number then output it verbatim
- when a symbol can be used to represent more than 1 character then default to the lexicon (first found) order of the alphabet

and so on

  • Like 1
Link to comment
Share on other sites

16 hours ago, Rolig Loon said:

At any Premium gift kiosk.  That is how all Premium gifts are distributed.

To get your premium virtual good, go to one of the inworld vending kiosks listed in the Second Life Destination Guide: http://secondlife.com/destinations/premium/gifts.

I missed the tombstone, is there any way to get the previous gifts? All I see now is the Winter Wonderland token.

Link to comment
Share on other sites

Ok. Out of interest, was the lettering method using texture offsets into a texture containing all the possible symbols with multiple faces on the prim to receive them? I did a system like that three years ago, I've since seen others using similar setups. Or is it something like the old yytext?

Link to comment
Share on other sites

17 hours ago, Rolig Loon said:

If that Premium gift is still available, and if you are Premium, get a copy.  Open it and look at how the scripts create the text on the gravestones.

1 minute ago, Profaitchikenz Haiku said:

Ok. Out of interest, was the lettering method using texture offsets into a texture containing all the possible symbols with multiple faces on the prim to receive them? I did a system like that three years ago, I've since seen others using similar setups. Or is it something like the old yytext?

I don't think this "gravestone with text-on-a-prim" thing is what OP actually wanted, which was to convert "weird symbols" into their legible alphanumeric characters A-Z, 0-1.

Text on a prim is not particularly difficult, you just need to lay out any symbols you want on a texture (or couple) with some clever arrangement and coding. I'd imagine that's what LL's gravestones are doing, if not even using the already existing user-created functions.

Link to comment
Share on other sites

13 minutes ago, Profaitchikenz Haiku said:

Out of interest, was the lettering method using texture offsets into a texture containing all the possible symbols with multiple faces on the prim to receive them? I did a system like that three years ago, I've since seen others using similar setups. Or is it something like the old yytext?

It's using FurwareText, which is a free, open-source, resident-created package.  Like you, I created my own version of something like XYText years ago and was quite happy with it.  Furware Text blows it out of the water.

Edited by Rolig Loon
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

On 12/7/2018 at 2:01 PM, Wulfie Reanimator said:

I don't think this "gravestone with text-on-a-prim" thing is what OP actually wanted, which was to convert "weird symbols" into their legible alphanumeric characters A-Z, 0-1.

Text on a prim is not particularly difficult, you just need to lay out any symbols you want on a texture (or couple) with some clever arrangement and coding. I'd imagine that's what LL's gravestones are doing, if not even using the already existing user-created functions.

It was just a wild guess at what the OP was trying to do. There weren't enough details to know exactly what they were trying to make. My assumption from their request to do special character to regular ascii was so that a regular Furware/XYText system could handle displaying peoples names.

The tombstones are a different animal, and can handle a much larger character set than XYtext can.

Edited by Phate Shepherd
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1961 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...