Save character data help
by Jason Holm · in Torque Game Engine · 06/19/2006 (1:59 pm) · 1 replies
Hello, I am very new with this and I'm trying to simply make it so you can make a custom character and save it. I would also like the all the saved characters to appear on a list (I need to get the save part working first!).
In my "MakeCharGui" file, I have a guitexteditctrl to enter the name, which works fine.
new GuiTextEditCtrl() {
Profile = "GuiTextEditProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "75 81";
Extent = "90 12";
MinExtent = "8 2";
Visible = "1";
Variable = "pref::Player::Name";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
};
Then I have a button to save the character.
new GuiBitmapButtonCtrl(save_char) {
Profile = "GuiDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "80 92";
Extent = "140 30";
MinExtent = "8 2";
command= "savechar();";
Visible = "1";
text = "Save Character";
groupNum = "-1";
buttonType = "PushButton";
};
I have this function to make the file (which I made from using other posts).
function savechar()
{
%name = pref::Player::Name;
%file = "./chars/" @ %name @ ".cs";
%exp = "$" @ %name @ "Stats::*";
export(%exp, %file, false);
}
It doesnt make a file for the character. Also, what exactly does the "false" and "%exp" doing? mean If anyone could give me some detailed help I would greatly appreciate it! (I'm very noob! =p). Oh, and is there a way to to make a custom look for the GuiTextEditCtrl, instead of just a white box? Or at least change the color for it? Thanks.
In my "MakeCharGui" file, I have a guitexteditctrl to enter the name, which works fine.
new GuiTextEditCtrl() {
Profile = "GuiTextEditProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "75 81";
Extent = "90 12";
MinExtent = "8 2";
Visible = "1";
Variable = "pref::Player::Name";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
};
Then I have a button to save the character.
new GuiBitmapButtonCtrl(save_char) {
Profile = "GuiDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "80 92";
Extent = "140 30";
MinExtent = "8 2";
command= "savechar();";
Visible = "1";
text = "Save Character";
groupNum = "-1";
buttonType = "PushButton";
};
I have this function to make the file (which I made from using other posts).
function savechar()
{
%name = pref::Player::Name;
%file = "./chars/" @ %name @ ".cs";
%exp = "$" @ %name @ "Stats::*";
export(%exp, %file, false);
}
It doesnt make a file for the character. Also, what exactly does the "false" and "%exp" doing? mean If anyone could give me some detailed help I would greatly appreciate it! (I'm very noob! =p). Oh, and is there a way to to make a custom look for the GuiTextEditCtrl, instead of just a white box? Or at least change the color for it? Thanks.
About the author
Torque Owner Cinder Games
%result = Export("$Pref::Game::*", "./game/prefs.cs", False);The first variable seems to be the search string. it will search for all global variables that match the search string such at "$BobStats::*", so i guess that all global variables starting with that will be saved to the file.
The true and fales if for append(true), and ovewrite(false)
Perhaps you should check the console after exporting, to see if any error messages where displayed.