About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
UID from Text
Author Message
Pherael Offline
Silver Supporter

Post: #1
UID from Text
Is there any function than can convert UID(...) from text?

I know ther is fromText() function but is only working with hexadecimal format so it's no handy at all, since in properties we can only copy "standard" UID.

In editor you could for example write UID(...,...,...,...) in object params so there should already be function that Esenthel using.
10-26-2013 06:31 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #2
RE: UID from Text
Why not just define the parameter as an ElementID in the editor? Then you can just do:

Code:
if(Param *p = obj.findParam("paramName")) ID = p.asID();
10-26-2013 07:18 PM
Find all posts by this user Quote this message in a reply
Pherael Offline
Silver Supporter

Post: #3
RE: UID from Text
I have my own editor for some data like visual effects, quests, proffesions etc. I need sometimes to pass UID, if I only could copy it from esenthel editor and paste in textline in my editor, a lot of thinks would be easier and faster for me.

I see esenthel editor using function reading UID from normal format, so I suspect, that Esenthel has this function written.
(This post was last modified: 10-26-2013 07:44 PM by Pherael.)
10-26-2013 07:32 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: UID from Text
Hi,
I'll add this for next release!
10-26-2013 09:27 PM
Find all posts by this user Quote this message in a reply
Pherael Offline
Silver Supporter

Post: #5
RE: UID from Text
Thank you Esenthel smile
10-26-2013 09:41 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #6
RE: UID from Text
I created my own function for converting UID fom text. I can post it when I get back home but that will be a few days.

Code:
static void StringToUID(Str str, UID& uid)
   {
      if (!Starts(str, "UID"))
      {
         uid.zero();
         return;
      }
      
      Str uidtext = SkipStart(str, "UID(");
      uidtext = SkipEnd(uidtext, ")");
      Memc<Str> splits = Split(uidtext, ',');
      if (splits.elms() != 4)
      {
         uid.zero();
         return;
      }
  
      uint a = TextUInt(splits[0]);
      uint b = TextUInt(splits[1]);
      uint c = TextUInt(splits[2]);
      uint d = TextUInt(splits[3]);
      uid.set(a, b, c, d);  
   }
(This post was last modified: 10-29-2013 03:50 AM by Rofar.)
10-27-2013 03:09 PM
Find all posts by this user Quote this message in a reply
Post Reply