![]() |
player logout - odd bug
This is at the end of the control-npc in my gs2 enabled server.
PHP Code:
It sends the echo to the rc correctly. Also what is the command like SPC for a carriage return or line feed, to have a new line in something like a sendpm message? |
Why are you using setstring() with a wacky combination of old and new strings? Why are you using setstring() at all?
Also: Click me to learn about "NL" and "TAB"! |
I have used setstring for at least five years, and in the wiki, my code example above is how setstring should be formatted - as far as i can tell.
Perhaps I should go a step back to algorithm-speak, and if you don't want me using setstring, then you can tell me another way/method to do it in gs2. NPC Code: so i ask again, why does the information get sent to the rc but not set into the string? Also, NL is not working in sendpm as it should: sendpm("test"@ NL @"123"); //causes an error: unexpected token: ) sendpm("test NL 123"); //shows the text NL in the string sendpm("test "@"NL"@" 123"); //shows the text NL in the string and i am out ot ideas of how else to use NL. help? |
Quote:
|
Quote:
In other words, it looks like in: Quote:
Assuming the above, your first argument's in reality going to be parsed for a value just like the second one is. You are inadvertantly setting a string with a name of the value of the first argument to the value of the second argument; in the above example, if serverr.radio_station1e was "pie", you would be setting a string named "pie" to whatever the value of serverr.radio_station1d. Following that, the proper usage of setstring for this situation would be: NPC Code: However, I contend that this is all just a silly waste of time considering the fact that GS2 is designed with the awesome power of variants (see here for more information). Instead, you can simply: NPC Code:serverr.radio_station1e = serverr.radio_station1d; Quote:
Quote:
|
Thanks! The variant method of serverr.string1=serverr.string2 occured to me as a posibility, I appreciate the confirmation.
I will try that. I also realized that two operators (such as @ and NL, or two NL's together) cannot be placed side by side. Much as one cannot do 1 + - 2, it is either 1 + 2 or 1 - 2. |
Quote:
useful because it takes 2 characters rather than 6. |
Quote:
|
Quote:
|
Quote:
|
|
Quote:
#DEFINE NL @"/n"@ #DEFINE SPC @" "@ #DEFINE TAB @"/t"@ It's a self concatenating new line in which it's required to have something preceding and proceeding it. However, you could probably call it an operator just because it's in a scripting language. EDIT: Wow, Stefan and I posted simultaneously. |
wow, thanks for all the help everyone!
NL is a lot easier than looking up the ascii value of carriage return and line feed, as I used to have to do in Perl when I was the webmaster for the third largest newspaper in New England. I remember /n from javascript and C++ days, when I molded my mind into object oriented programming after 15 years of procedural programming. However, I don't recall what a new line was in Basic, but I have not actively written in Basic for many years. That reminds me, I should start my documentation of how gs2 is object oriented sometime soon. Thanks again everyone! |
Quote:
#DEFINE SPC @ " " @ #DEFINE TAB @ "\t" @ Although, I do not believe it is as simple as using #DEFINE. |
Quote:
Quote:
|
Quote:
|
Quote:
|
Lawrence Eagle-Tribune. Stopped working there a couple years ago, and when they purchased the north of Boston papers, their subscriber base surpassed the Union Leader. But recently they were bough by some place in Alabama or something.
|
Quote:
|
| All times are GMT +2. The time now is 07:21 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.