Howto design a "text box" (rpg like txt boxes)
by Steven Garcia · in Torque Game Builder · 08/13/2007 (5:36 pm) · 4 replies
Ive already figured out how im going to pause and bring out the character pics (like the ginormous pics that stand behind the text thats being spoken) but it just hit me that i dont have a clue on how im going to make the text boxes or the text flow smoothly for that matter
so my question is. does anybody have any good ideas on how to design a scripting text like feature for tgb?
so my question is. does anybody have any good ideas on how to design a scripting text like feature for tgb?
#2
%guiContent = new GuiControl(testgui) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiWindowCtrl() {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "215 82";
Extent = "315 335";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
maxLength = "1024";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
new GuiScrollCtrl(textscroll) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiScrollProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "6 24";
Extent = "304 307";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
willFirstRespond = "1";
hScrollBar = "alwaysOn";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiTextListCtrl(textlist) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiTextListProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "2 2";
Extent = "284 2";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
new GuiBitmapCtrl(textmask) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "-1 -2";
Extent = "300 299";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "~/data/images/white.png";
wrap = "0";
};
};
};
};
function testgui::onwake(%this)
{
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
testgui.schedule(30,moveMask);
}
function testgui::moveMask(%this)
{
if (textmask.Position > 400)
return;
%position = textmask.Position;
textmask.setPosition(getword(%position,0),getword(%position,1)+1);
testgui.schedule(100,moveMask);
}
08/14/2007 (9:51 am)
I came up with a way to show a line at a time, assuming you are using gui controls. The "moveMask" is a guibitmapctrl with a white image that starts on top of the guitextlist. It would be even nicer if you could "feather" the top of the bitmap to be partially transparent but there is currently no support for partially transparent bitmap controls.%guiContent = new GuiControl(testgui) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiWindowCtrl() {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "215 82";
Extent = "315 335";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
maxLength = "1024";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
new GuiScrollCtrl(textscroll) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiScrollProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "6 24";
Extent = "304 307";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
willFirstRespond = "1";
hScrollBar = "alwaysOn";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiTextListCtrl(textlist) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiTextListProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "2 2";
Extent = "284 2";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
new GuiBitmapCtrl(textmask) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "-1 -2";
Extent = "300 299";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "~/data/images/white.png";
wrap = "0";
};
};
};
};
function testgui::onwake(%this)
{
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
textlist.addrow("word word word word word word",0);
testgui.schedule(30,moveMask);
}
function testgui::moveMask(%this)
{
if (textmask.Position > 400)
return;
%position = textmask.Position;
textmask.setPosition(getword(%position,0),getword(%position,1)+1);
testgui.schedule(100,moveMask);
}
#3
trying them both out right now actually
08/17/2007 (11:36 am)
Sorry for the long time to reply, thank you both for the infotrying them both out right now actually
#4
09/06/2007 (9:57 pm)
Steven, did you get around to trying these ideas? How did they work?
Associate Phillip O'Shea
Violent Tulip
%string = "Hello Steven"; for (%charNum=0; %charNum<strlen(%string); %charNum++) { %textBox.schedule(10*%charNum, popNextChar, %string, %charNum); }function popNextChar(%this, %string, %charNum) { %this.text = %this.text @ getSubstr(%string, %charNum, %charNum+1); }This is just off the top of my head, but its the basic idea that *should* work. Just loop through, scheduling characters popping out, and append a character onto your text box.
This assumes that you're using T2DTextObject, not GUITextObject.
If I've completely missed what you were getting at, then ignore the above.