Author Topic: Solved: enter/return with strings  (Read 356 times)

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Solved: enter/return with strings
« on: March 23, 2012, 03:52:57 am »


               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 .
                     
                  


            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #1 on: March 23, 2012, 04:43:39 am »


               I don't know if it'll work with descriptions but you could try "\\n"

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

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #2 on: March 23, 2012, 10:04:05 pm »


               It does work with descriptions.
               
               

               
            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #3 on: March 24, 2012, 01:41:39 am »


               That did the trick thank you !!!
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #4 on: March 24, 2012, 01:49:46 am »


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

               
            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #5 on: March 27, 2012, 10:13:48 pm »


               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.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #6 on: March 27, 2012, 10:37:15 pm »


               

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.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #7 on: March 27, 2012, 11:42:56 pm »


               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 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #8 on: March 27, 2012, 11:49:17 pm »


               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
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #9 on: March 28, 2012, 12:34:25 am »


               

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 .
                     
                  


            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Solved: enter/return with strings
« Reply #10 on: March 28, 2012, 06:24:33 pm »


               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.