Jump to content
Sign in to follow this  
Killian Jayaram

String + Text = Vector(Name)

Recommended Posts

Maybe it's just getting late and google does not like me, but I am currently trying to use llGetsubstring to get the letter from a string and then add to a vector name.


May not make sence, so here...

vector texta = <0.0, -0.0, 0.0>;

string words = "abc";

(vector)text + llGetSubString((string)words, 0, 0) // THIS LINE NOT WORKING FOR ME

 

How would i go about doing this or am i doing it all wrong?

 

(This is so i can change the texture vector baced on string without each texture change every time i make changes)

 

 

 

Share this post


Link to post
Share on other sites

It's a bit unclear what you're attempting but if you're trying to dynamically change the name of a variable, that can't be done.

 

If you're wanting to use different textures according to a letter in a supplied string, extract the letter into a string variable and then use an if else chain to set a variable to the one you wish to display.

Share this post


Link to post
Share on other sites

See i thought someone was going to say that and i was tring to take the easy way out as i did not want to have to make 30 or so if and else commands but set the string and then work out from that the vector =p

 

Share this post


Link to post
Share on other sites

Though that is supported in some languages, LSL limits us to changing only the values within named variables, whose names are pretty much written in stone. Now, if only we had a switch statement!

Share this post


Link to post
Share on other sites

Problem from when i come from PHP and JS the rules change, I will try making the vector to a list and output based on string and see if that works nay better as if and else make this to long and to much of a lag.

Share this post


Link to post
Share on other sites


Killian Jayaram wrote:

Problem from when i come from PHP and JS the rules change, I will try making the vector to a list and output based on string and see if that works nay better as if and else make this to long and to much of a lag.

I feel that would be an excellent approach to the problem! I wish you good luck in implementing it and if you encounter any problems with it, just ask.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...