Okay basically this NPC will take a string, tokenize that string and automattically put in line breaks when one line get's too large, here it is:
NPC Code:
// NPC made by Lady Midnight
if (created) {
this.maxlinelength=32;
this.lettersusedonline=0;
setstring test.string,This is just a test of an auto line break making system I hope I can get it to work as it would be pretty cool for editable news and stuff and okay at this point I'm just going to put in some filler don't be surprised if you see strange stuff ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz boring isn't it? Oh well the point of this is to make it as long as possible so I guess that's okay... Some other possible uses could be a guestbook. A place where people can write books in Graal and if you think long and hard about it a real lot of stuff. Anyway this is my biggest string manipulation yet. I think I might put in something for adding line breaks to it <br> or whatever. If you're wondering why there's nearly no puntuation that has to do with the fact that it somehow doesn't accept commas
}
if (playertouchsme) {
setstring player.readingpage,0;
setstring sign.readstring,;
tokenize #s(test.string);
this.lettersusedonline=0;
for (this.i=0;this.i<tokenscount;this.i++) {
this.lettersusedonline+=strlen(#t(this.i))+1;
if (this.lettersusedonline>this.maxlinelength) {
setstring sign.readstring,#s(sign.readstring)" "#t(this.i);
this.lettersusedonline=0+strlen(#t(this.i));
}
else if (this.i==0) setstring sign.readstring,"#t(this.i);
else setstring sign.readstring,#s(sign.readstring) #t(this.i);
}
tokenize #s(sign.readstring);
setstring sign.pages,#v(int((tokenscount-1)/3));
say2 #t(strtofloat(#s(player.readingpage))*3)
#b#t(strtofloat(#s(player.readingpage))*3+1)
#b#t(strtofloat(#s(player.readingpage))*3+2);
}
if (playerendsreading) {
setstring player.readingpage,#v(strtofloat(#s(player.reading page))+1);
if (strtofloat(#s(player.readingpage))<=strtofloat(#s (sign.pages))) {
say2 #t(strtofloat(#s(player.readingpage))*3)
#b#t(strtofloat(#s(player.readingpage))*3+1)
#b#t(strtofloat(#s(player.readingpage))*3+2);
}
}
And believe it or not that whole long string up there get's reworked into a sign without problems.