Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Wraptext 2? (https://forums.graalonline.com/forums/showthread.php?t=61443)

Torankusu_2002 09-27-2005 06:40 PM

Wraptext 2?
 
Wraptext 2, in GS1, I understand how it works.

Instead of tokens (gs1), can it read directly from the string you are wraptext2-ing now in GS2?

I need to wrap multiple strings (text), but I don't want to use the same tokens over and over again. (I'll show an example later if people are unclear of what I am talking about.)

I've got a HUD/GUI scripted in GS1 that works pretty well, I just can't go any further because I can't wrap but one string because it reads the wrapped text as tokens.

napo_p2p 09-27-2005 07:21 PM

Are asking if 'wraptext2' in GS2 can return to something else other than tokens?

ForgottenLegacy 09-28-2005 12:14 AM

Assign the tokens to an array. Example:
PHP Code:

this.string "value with spaces";
this.tokens this.string.tokenize();
// this.tokens[0] == "value", and so on 

I would suspect you'd do the same with wraptext and wraptext2.

Torankusu_2002 09-28-2005 04:29 AM

Quote:

Originally Posted by ForgottenLegacy
Assign the tokens to an array. Example:
PHP Code:

this.string "value with spaces";
this.tokens this.string.tokenize();
// this.tokens[0] == "value", and so on 

I would suspect you'd do the same with wraptext and wraptext2.

Er, you're not getting what I am saying, I don't think. Either that, or I don't understand where you're getting at...

Anyways, The problem with using tokens for wraptext2 for what I am trying to script is I am doing this:

Wraptext2 this1string. (examples only)
Wraptext2 this2string.

I am trying to place this1string in a certain position (there's no set# of letters/pixels it will be.)

And I am trying to place this2string at another place. The problem with this is, with the for loop, it checks tokens [ for (this.i=0;this.i<tokenscount;this.i++) ] to display the text properly as well as wrap. I can get one string to wrap, but the second string shows up the same as the first, and there is no way that I can think of to determine the separate strings' token #'s.

Understand better now?

Anyways, I was informed that in GS2 the strings are set to arrays instead of tokens, so that they could be accessed better. (strlen i think? for the array in the foor loop.) so that it would display the correct text. True?

napo_p2p 09-28-2005 05:16 AM

Ok, I think I know where you are getting at (correct me if I am wrong). You want to wrap the text of two separate strings, but want them put into separate string arrays? If so, GS2 makes that super easy.

PHP Code:

tokens1 wraptext2(zoomwidthdelimsString1);
tokens2 wraptext2(zoomwidthdelimsString2);
//Of course, edit the arguments 

Anyways, that would take String1 and String2, wrap their text and put it into 'tokens1' and 'tokens2', respectively.

Torankusu_2002 09-28-2005 05:33 AM

Quote:

Originally Posted by napo_p2p
Ok, I think I know where you are getting at (correct me if I am wrong). You want to wrap the text of two separate strings, but want them put into separate string arrays? If so, GS2 makes that super easy.

PHP Code:

tokens1 wraptext2(zoomwidthdelimsString1);
tokens2 wraptext2(zoomwidthdelimsString2);
//Of course, edit the arguments 

Anyways, that would take String1 and String2, wrap their text and put it into 'tokens1' and 'tokens2', respectively.

Yes, this is what I was wanting confirmation on.

I had been told GS2 made it super easy because the problem had been ran into in the past.

So...now all I have to do is convert my whole GUI to GS2. :)
yay.

Torankusu_2002 09-29-2005 05:27 AM

the only problem I am having now is trying to display it in a showtext.

NPC Code:

token1.wraptext2(760,1," ",client.questtitle);
token2.wraptext2(760,1," ",client.questtitle2);



and later ->

NPC Code:

for(this.i = 0; this.i < token1.size(); this.i++){
showtext(1,screenwidth/2-210,screenheight/2-80+(this.i*15),"Arial","B",token1[this.i]);

changeimgvis(1,5);
changeimgzoom(1,.6);
}



That could be horribly wrong, but I don't know much about the whole object system and how I would access the text I've wrapped..

Also, index is set to 1 for testing purposes only. I haven't assigned it an index yet.

napo_p2p 09-29-2005 05:32 AM

use:
PHP Code:

token1 wrapText2(zoomwidthdelimsString1); 

instead of:
PHP Code:

token1.wrapText2(zoomwidthdelimsString1); 


Torankusu_2002 09-29-2005 05:47 AM

sorry for double posting, but I was wondering if there was a max amount of characters that could be held in a string? Or displayed using wraptext2 ?

It seems like it cuts out half of the string when it wraps the text.

Torankusu_2002 09-29-2005 02:32 PM

2 Attachment(s)
Here are screenshots of my problem.

First SS:
Both strings display properly, but they aren't maxed out to where they would have to wrap and display both beginning of the string and end.
The string on top is:
client.questtitle=This is a test to see if all of the stuff is working right. aaaaaaaaaaa bbbbbbbbb

Second SS:
The bottom string is still displaying properly, but when I add more text for the wraptext2 to wrap, it WRAPS the text correctly, but it takes away the text above it.

Portion I am using to display the text:
NPC Code:

//Displaying the First String.
for(this.i = 0; this.i < token1.size(); this.i++){
showtext(216,screenwidth/2-210,screenheight/2-80+(this.i*15),"Arial","B",token1[this.i]);
changeimgvis(216,5);
changeimgzoom(216,.6);
}
//Displaying the Second String.
for(this.j = 0; this.j < token2.size(); this.j++){
showtext(217,screenwidth/2-210,screenheight/2-10+(this.j*15),"Arial","B",token2[this.j]);
changeimgvis(217,5);
changeimgzoom(217,.6);
}



Would it be anything wrong with the way I am wraping the text?
NPC Code:

token1 = wraptext2(760,1," ",client.questtitle);
token2 = wraptext2(760,1," ",client.questtitle2);


napo_p2p 09-29-2005 07:32 PM

Quote:

Originally Posted by Torankusu_2002
NPC Code:
changeimgzoom(216,.6);


NPC Code:
token1 = wraptext2(760,1," ",client.questtitle);


The second param for wrapText2 is the zoom you are using.
(Yours isn't matching).

Torankusu_2002 09-29-2005 09:48 PM

Quote:

Originally Posted by napo_p2p
The second param for wrapText2 is the zoom you are using.
(Yours isn't matching).

What is the syntax for the GS2 wraptext2?

ForgottenLegacy 09-30-2005 12:27 AM

Quote:

Originally Posted by Torankusu_2002
What is the syntax for the GS2 wraptext2?

From scriptfunctions_client.txt:
PHP Code:

wraptext2(intfloatstrstr) - returns object 

I would assume it's 'width','zoom','font','text'

napo_p2p 09-30-2005 02:31 AM

Quote:

Originally Posted by Torankusu_2002
What is the syntax for the GS2 wraptext2?

I believe it's the same for old gscript....

Quote:

Originally Posted by napo_p2p
use:
PHP Code:

token1 wrapText2(zoomwidthdelimsString1); 

instead of:
PHP Code:

token1.wrapText2(zoomwidthdelimsString1); 


I put it there :P.


All times are GMT +2. The time now is 04:31 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.