Aller au contenu

Photo

Is there an easy way to...


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

#1
Tarot Redhand

Tarot Redhand
  • Members
  • 2 694 messages
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

#2
Shadooow

Shadooow
  • Members
  • 4 471 messages
dont know what is cr/lf but you can get newline via "\\n"

#3
ehye_khandee

ehye_khandee
  • Members
  • 855 messages
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

#4
Greyfort

Greyfort
  • Members
  • 234 messages
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.

#5
ehye_khandee

ehye_khandee
  • Members
  • 855 messages
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).

#6
Greyfort

Greyfort
  • Members
  • 234 messages
ok thats great to know I did not know \\n did that thanyou Shadow/ehye :)

#7
Tarot Redhand

Tarot Redhand
  • Members
  • 2 694 messages
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

#8
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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 .


#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.

#10
Tarot Redhand

Tarot Redhand
  • Members
  • 2 694 messages
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