Quote:
|
Originally Posted by prozac424242
One thing in gs2 that I have been trying off and on how to figure out is how to put variables in strings. After seeing some random examples and taking a closer look at the gscript wiki page that I have read many times, it finally occured to me. And since for me, the solution was so elusive, I will post it here so others can see how this rather simple thing is done.
The @ symbol is what combines strings, or strings and variables, in gs2.
If you want a gui box to show the player's name at the end, you could have the text line of the GuiTextCtrl box be
|
Yes, if you would have RTFM, you would have figured this out quite quickly.
Quote:
|
Originally Posted by prozac424242
If, instead of the player's name, you want to put in a player variable or a server string, #s(client.whateveryoucalledthestring) and #s(serverr.thestringnameyougavefortheserverstring) still works.
|
Quote:
|
Originally Posted by Lance
4) If you do not know what you are doing, please do not post a solution here. Doing so only confounds the original advice-seeker. People who consistently post bad advice will be masked from the scripting forum.
|
You should
NOT mix old-graalscript identifiers (#s), with the new graalscript, there is absolutely no need.
PHP Code:
text = "This works: " @ client.stringname @ ", Imagine that.";
Quote:
|
Originally Posted by prozac424242
Also, if you have a Gui box whose text you want updated, having any kind of setTimer(number) will casue the text to flash. .05 time casues the text to not show at all, if read from a server string, if I remember correctly the server's fastest response time is .1, so in the timeout, do a check that grabs the string value to a variable, sleep for .1, and check the variable against the current string value. If the values differ, then update the text attribute of whatever you called the box. The text attribute for GuiTextCtrl ("My_Text") would be My_Text.text and you can set it equal to whatever you like in a separate part of the npc.
|
Do
NOT use Sleep() in a timeout.