Aller au contenu

Photo

Solved: enter/return with strings


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
nwnsmith

nwnsmith
  • Members
  • 67 messages
I am editing descriptions of items and I want to know if there is a way to get to the net line.

For instance now I am using

s = "mytext"+"more text"+more text"

the result would be: mytextmoretextmoretext

but I would like the result to be:

mytext
moretext
moretext

Thanks for any help!!!

 

Modifié par nwnsmith, 24 mars 2012 - 01:42 .


#2
Alex Warren

Alex Warren
  • Members
  • 179 messages
I don't know if it'll work with descriptions but you could try "\\n"

s = "mytext"+"\\n"+"more text"+"\\n"+"more text"

#3
Xardex

Xardex
  • Members
  • 217 messages
It does work with descriptions.

#4
nwnsmith

nwnsmith
  • Members
  • 67 messages
That did the trick thank you !!!

#5
henesua

henesua
  • Members
  • 3 883 messages
if only that would work with all text in NWN.... Or does it?

#6
Zwerkules

Zwerkules
  • Members
  • 1 324 messages
Maybe it does. I know that descriptions aren't the only strings for which this works. There may be cases where \\n (new line) doesn't work. I also never tried if other things like \\t (tab) and \\b (backspace) work but it is possible that they do.

#7
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

henesua wrote...

if only that would work with all text in NWN.... Or does it?


Don't know,  I myself have never gotten it to work In any place I tried it.  But I have not tried it in many places either.

#8
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
It does work if scripted.

SetName
SetDescription
SendMessageToPC
FloatingTextStringOnCreature

If you needed to use the "\\n" via the OnChat event you have to replace it with itself in the script via string parsing or it will just literally use \\n instead of a new line.

And while unnecessary you can also set a custom token to "\\n" and use it in conversations and journal entries.

P.S. \\t and \\b do not seem to work anywhere.

Modifié par GhostOfGod, 27 mars 2012 - 10:52 .


#9
henesua

henesua
  • Members
  • 3 883 messages
Good to know. I've got a global var that I've been pulling from dialog.tlk. But I could simply change this global var to a constant and set it equal to "\\n"

thanks

#10
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

GhostOfGod wrote...

It does work if scripted.

SetName
SetDescription
SendMessageToPC
FloatingTextStringOnCreature

If you needed to use the "n" via the OnChat event you have to replace it with itself in the script via string parsing or it will just literally use n instead of a new line.

And while unnecessary you can also set a custom token to "n" and use it in conversations and journal entries.

P.S. t and b do not seem to work anywhere.



Well, Ghost I have cut and pasted code you have posted in the past with the /n amd it did not work for me.  The only thing I can think of is that you are using one of the upgraded compilers where I am still using the standard one. 

EDIT:  Well I Dont Know what I did wrong before now.  I just tested it again and it is working for me now.  *shrugs*

Modifié par Lightfoot8, 27 mars 2012 - 11:42 .


#11
nwnsmith

nwnsmith
  • Members
  • 67 messages
Lightfoot8 the problem you might be having is that it is not "/n". It is "\\n" That gave me a little trouble in the beginning.