Author Topic: Is there an easy way to...  (Read 556 times)

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Is there an easy way to...
« on: April 05, 2011, 10:55:32 am »


               Is there an easy way to insert a cr/lf or newline sequence into a string. If not I'll just have to create a small include file that contains just const statement, compile it and then hack it with a hex editor. Don't know if that would work and it seems a lot of work a simple need.

TR
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Is there an easy way to...
« Reply #1 on: April 05, 2011, 11:26:01 am »


               dont know what is cr/lf but you can get newline via "\\n"
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Is there an easy way to...
« Reply #2 on: April 05, 2011, 04:04:26 pm »


               cr/lf = carriage return / line feed

the former being a throwback to ancient times when people used TYPEWRITERS and had to use the carriage return bar to shove the carriage back to the beginning of the next line of text (advancing one line and moving to left of that line).

GM_ODA is a fossil and remembers these things. lol
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Is there an easy way to...
« Reply #3 on: April 06, 2011, 08:51:50 am »


               and you want a carage return for what?  some limits the toolset has is no subscripted variables ie:

string sStringname1="name"
string sStringname2="a"
string sStringname3="b"
for x= 1 to 3
?=print sStringname(x) rem from basic, a quick example
next x

result would be :
name
a
b

so I dont think you can do the carage return, because there realy is no practle use since text display doesnt seem to be vary important in the game.  But I could be wrong.

I my self come from old programing and I would find it useful in displaying text, I would also find subscripted variables useful.
the most you seem to be able to do is:
object oPlayer;
string szMessage;
string sString="some string";
int nCnt
for (nCnt=1;nCnt >3;nCnt++)
{
szMessage=sString+IntToString;
SendMessageToPC( oPlayer,  szMessage)
}
so you should get message:
some string1
some string2
some string3

those are just some of the limits there are more.
I hope i answered your question, I like to know what you find out.
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Is there an easy way to...
« Reply #4 on: April 06, 2011, 12:33:00 pm »


               The purpose of the cr/lf is the same as our computers'   '\\n' as noted by Shadow above, it ends the line and begins a new one (formatting).
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Is there an easy way to...
« Reply #5 on: April 06, 2011, 09:13:48 pm »


               ok thats great to know I did not know \\n did that thanyou Shadow/ehye '<img'>
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Is there an easy way to...
« Reply #6 on: April 08, 2011, 03:37:04 pm »


               Thanks guys. Just I couldn't find about this anywhere I looked. I need this since I have an idea for something that I'll keep under wraps until I release it. Suffice to say that it has to do with the fact that you can set the description for objects programmatically (since 1.69) I think.

TR
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Is there an easy way to...
« Reply #7 on: April 08, 2011, 07:33:07 pm »


               Just a heads up Tarot. If you plan on doing this via the OnPlayerChat the "\\n" doesn't work the same way. You have to replace it with itself using the StringReplace function.

I had to figure this out over in the NWN2 fourms: social.bioware.com/forum/1/topic/164/index/6732633
               
               

               


                     Modifié par GhostOfGod, 08 avril 2011 - 06:34 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Is there an easy way to...
« Reply #8 on: April 08, 2011, 09:50:38 pm »


               If the \\n does not work for you correctly in some spots, You could alway just grab a carrage return out of the Dialog.tlk file.  

string sLineFeed =GetSubString(GetStringByStrRef(54),37,1);

Should work, That is if I didn't miss count where the line feed was at.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Is there an easy way to...
« Reply #9 on: April 12, 2011, 10:30:04 am »


               Thanks GhostOfGod and Lightfoot8 both pieces are well worth knowing. I have now got what I had planned, working and if I'd known just how much work it was going to take and how much it would make the mod grow, I wouldn't have started on this particular idea. I suppose I'll feel good when I've actually finished this "little" idea.

TR