load level issue/setting new gui issue
by Joseph Bosch · in Torque Game Builder · 10/22/2011 (2:07 pm) · 7 replies
so per forms i looked up i setup a scheduled function to load a level
schedule(100, 0, "loadInterior");
and then
function loadInterior()
{
echo("line 74");
sceneWindow2D.loadLevel("game/data/levels/playerDesign.t2d");
echo("line 77");
Canvas.setContent(playerGui);
setLists();
}
and it crashes every time with the last thing in the log being
line 74
Loading compiled script C:/Users/PC/Documents/MyGames/ED/game/data/levels/playerDesign.t2d.
line 77
so something about setting this new gui is screwing things up
it does compile though
Loading compiled script C:/Users/PC/Documents/MyGames/ED/game/gui/player.gui.
and as far as I can tell its setup correctly
%guiContent = new GuiControl(playerGui) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiBlackContentProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "800 600";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiListBoxCtrl(EquipList) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiListBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "63 79";
Extent = "8 2";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
AllowMultipleSelections = "1";
fitParentWidth = "1";
};
new GuiListBoxCtrl(list) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiListBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "574 73";
Extent = "8 2";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
AllowMultipleSelections = "1";
fitParentWidth = "1";
};
};
schedule(100, 0, "loadInterior");
and then
function loadInterior()
{
echo("line 74");
sceneWindow2D.loadLevel("game/data/levels/playerDesign.t2d");
echo("line 77");
Canvas.setContent(playerGui);
setLists();
}
and it crashes every time with the last thing in the log being
line 74
Loading compiled script C:/Users/PC/Documents/MyGames/ED/game/data/levels/playerDesign.t2d.
line 77
so something about setting this new gui is screwing things up
it does compile though
Loading compiled script C:/Users/PC/Documents/MyGames/ED/game/gui/player.gui.
and as far as I can tell its setup correctly
%guiContent = new GuiControl(playerGui) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiBlackContentProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "800 600";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiListBoxCtrl(EquipList) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiListBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "63 79";
Extent = "8 2";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
AllowMultipleSelections = "1";
fitParentWidth = "1";
};
new GuiListBoxCtrl(list) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiListBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "574 73";
Extent = "8 2";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
AllowMultipleSelections = "1";
fitParentWidth = "1";
};
};
#2
10/24/2011 (1:58 am)
Does your list contain any items?
#3
maybe I am going about this the wrong way could some one provide me with the code they use to change levels and apply a new gui in the level?
10/24/2011 (9:03 am)
I don't know the game crashes before anything gets set to the list, as I said if i comment out all of the list.setItemText the game is fine, but if i don't it crahes.maybe I am going about this the wrong way could some one provide me with the code they use to change levels and apply a new gui in the level?
#4
10/25/2011 (8:56 am)
I have done further testing, on this issue, if i remove the code for the list the game continues but with strange anomalies. for one all the imagemaps on the screen disappears which is expected but the old GUI remains, so perhaps the new gui is not not loading for some reason, is there a way to force the unload of the previous GUI? i tried something along the lines of Canvas.clear(); but that did not help.
#5
10/25/2011 (10:37 am)
ok the old gui is now clearing completely but the new gui doesn't seem to be loading
#6
list.setItemText(0, "sex");
no idea why that would crash torque but hey i figured it out,
now though I am getting GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
so at-least I am getting someplace
10/25/2011 (10:58 am)
ok so i decided i would try something new, comment out code until it stops crashing, commenting out this single line of code prevents the level from crashinglist.setItemText(0, "sex");
no idea why that would crash torque but hey i figured it out,
now though I am getting GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::getItemText - index out of range!
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
GuiListBoxCtrl::setItemColor - invalid index
so at-least I am getting someplace
#7
seems to fix the issue but I am not getting the text only a red bullet, I will post a another thread as this is a different issue
10/25/2011 (11:10 am)
using list.insertItemseems to fix the issue but I am not getting the text only a red bullet, I will post a another thread as this is a different issue
Torque Owner Joseph Bosch
Default Studio Name
echo("line 3");
%color = "1.0 0.0 0.0";
list.setItemText(0, "sex");
list.setItemText(1, "att");
list.setItemText(2, "hair");
list.setItemText(3, "armor");
list.setItemText(4, "resistance");
list.setItemText(5, "magic resistance");
list.setItemText(6, "support");
for (%i = 0; %i < 7; %i++)
{
list.setItemColor(%i, %color);
}
as a further anomoly i do not even get "line 3" in the console.log file unless i comment out all the list.setItem's
any one have any thoughts on where i went wrong on this one?