Jump to content
Gabryel Nyoki

Detecting alphabetic characters

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 :)

Share this post


Link to post
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!

}

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
On 10/8/2018 at 8:23 PM, Gabryel Nyoki said:

Hi,

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

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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
5 hours ago, Gabryel Nyoki said:

Thank you for your replies

Something like that yes!

If you have a premium account, you might want to check out the gravestones in the current premium gift.

 

Share this post


Link to post
Share on other sites
On 10/12/2018 at 12:46 PM, Phate Shepherd said:

If you have a premium account, you might want to check out the gravestones in the current premium gift.

 

I do not understand what you mean at all...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
2 minutes 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.

get a copy... where? O_O

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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?

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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...

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Nope.  Premium gifts are offered for a limited time and then removed from the kiosks.  LL puts out three or four gifts a year for Premium members.  They also use the kiosks for distributing special event tokens, as you have discovered.

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×