Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-27-2005, 08:53 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
gs2 line breaks?

How do you do line breaks in gs2? Is it still #b? I'd doubt it.
Reply With Quote
  #2  
Old 10-27-2005, 09:19 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
\n
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 10-27-2005, 12:38 PM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
Short and simple... ^_^ ( Napo got it )
__________________
In a world of change... Who'll you believe?
Reply With Quote
  #4  
Old 10-27-2005, 01:45 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Well it depends.
You can do
say2("Hello!\nThis is the next line.");
or you can do
say2("Hello!
This is the next line.");
The second way is easier readable if you have long text I guess.
Reply With Quote
  #5  
Old 10-27-2005, 10:30 PM
Maniaman Maniaman is offline
Registered User
Join Date: Aug 2005
Posts: 326
Maniaman is on a distinguished road
RC always escapes \n for me when it is used in a script. Hitting end it will be converted from \n to \\n
__________________

Current Maloria Event: (click to go to it)
Reply With Quote
  #6  
Old 10-28-2005, 01:23 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by Maniaman
RC always escapes \n for me when it is used in a script. Hitting end it will be converted from \n to \\n
yes has happened to me too...\n becomes \\n when updating.
__________________
Reply With Quote
  #7  
Old 10-28-2005, 04:51 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Stefan
Well it depends.
You can do
say2("Hello!\nThis is the next line.");
or you can do
say2("Hello!
This is the next line.");
The second way is easier readable if you have long text I guess.
Actually stefan, should scripted line breaks really be read as string line breaks when you can just do:
say2("Hello!\n"
+ "This is the next line.");
??
Reply With Quote
  #8  
Old 10-28-2005, 05:51 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Quote:
Originally Posted by jake13jake
Actually stefan, should scripted line breaks really be read as string line breaks when you can just do:
say2("Hello!\n"
+ "This is the next line.");
??
Okay, few things here.
1) Stefan made GS1 and GS2, I'd assume he knows exactly what he's talking about regarding GraalScript, and I'd be supprised if someone corrected him on something completely wrong.
2) The character you want to use is '@', not '+'. The addition character treats both the strings as numbers and then tries to add them. I'm believing since both the strings are not NULL, you'll get a message saying '2'.
3) Scripted line breaks are string line breaks, but the only exception is that the line break is contained within the string. (Someone correct me on this, mmkay?)

I'd say use Stefan's idea for big, long messages, and use the "string\nstring" idea for shorter messages. The NPCServer's sendpm on a player's login uses Stefan's idea, typically, although I think I've seen it done the other way. I don't remember.

Anyway, use whichever way you please: either contain a line-break within the quotes, or contain a \n within the quotes. Up to you.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #9  
Old 10-28-2005, 12:03 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by ForgottenLegacy
3) Scripted line breaks are string line breaks, but the only exception is that the line break is contained within the string. (Someone correct me on this, mmkay?)
Line breaks are line breaks. However, the scripting engine will treat them differently depending on where they are.

\n is an escaped character which is eventually replaced by a line break.

Thus, using \n is unnecessary for many new lines, since
HTML Code:
say2("HELLO\n" @
"LOL\n" @
"foo");
eventually becomes:
HTML Code:
say2("HELLO
" @
"LOL
" @
"foo");
especially when this is shorter:
HTML Code:
say2("HELLO
LOL
foo");
Concerning \\n, \\n is probably escaping the first "\", so that it does not escape "n". When it is displayed in RC, it is possibly being escaped again when it shouldn't be.
__________________
Skyld
Reply With Quote
  #10  
Old 10-28-2005, 01:10 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Probably old RC?
Reply With Quote
  #11  
Old 10-28-2005, 08:31 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by ForgottenLegacy
Okay, few things here.
2) The character you want to use is '@', not '+'. The addition character treats both the strings as numbers and then tries to add them. I'm believing since both the strings are not NULL, you'll get a message saying '2'.
okay... so... why do you need to correct me? Sheesh, sorry for getting my scripting languages mixed up. Concatenation is the concept we're going for, and as far as we understand eachother on that level, what's the need?

Still I'd prefer

temp.message = "blah\n"
-indentation- @ "blah"
say2(temp.message);

just so I could line up the bottom string with the top string. I think that's a lot better readability, so you can see how all of the text lines up.

Maybe even

temp.message = "blah" @ "\n"
-indentation- @ "blah"
say2(temp.message);
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.