Inventory v3 Tutorial
by Tim Newell · 01/12/2002 (8:39 am) · 25 comments
Download Code File
Inventory v.3 Tutorial
Note: This is Inventory v2 but it has been modified to use My new Inventory Manager which is also required for this tutorial. It can be found at Inventory Manager Tutorial. There was a slight change in the game.cs file when I posted this tutorial (Healthkit's type needs to be "healthKit" not "item")
This tutorial will help you create a Graphical Display of the items that the player has on them. To invoke the Gui you press the letter i and press i again to exit it.
The tutorial requires my tutorial (Adding Mouse Events to Gui Controls) it can be found here: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1864
Using the above tutorial, you need to add mouse events to GuiTextCtrl and GuiBitmapCtrl for this tutorial.
Note: This tutorial was done with the head version (but it was a bit old, hopefully nothing has changed that will effect this tutorial) from the CVS. Warning: the C++ code changes ONLY work with the head version since the resManager.cc and resManager.h are from the head version. You can get it to work with non head by modifying your resManager.cc and resManager.h files, but still use the GuiObjectView.cc and GuiObjectView.h in the zip on this page.
This tutorial is a modification of the Inventory Popup Tutorial, so you can find some info on the GUI creation in that tutorial. The dts viewing code was given to me by ExoDuS, he got it from this tutorial - perso.wanadoo.fr/hysteria/docs/guiCtrls.htm You will need the following zip for the tutorial to work (since it was modified from the orginal by ExoDuS for the setEmpty() command) (Code File link at the top of this page). The zip contains the files guiObjectView.cc, GuiObjectView.h (they go in /engine/gui) and resManager.cc, resManager.h (they replace the ones in your /engine/core) Add those to your project and recompile. More on the GUI at the end of this tutorial.
This version of the Inventory has a list of your inventory items on the left and you click on the name of the item to display its model with a description.
Even though this is a modification I am going to show you all of the coding that it takes to complete it. The only file that were modified though were (InventoryGui.cs, commands.cs, and inventory.cs)
First open the file - C:\GarageGames\torque\example\fps\client\scripts\default.bind.cs Go down to the section:
and add the following code:
Next open the file - C:\GarageGames\torque\example\fps\client\config.cs and add the following line to the end:
Next open the file - C:\GarageGames\torque\example\fps\client\init.cs and add after the other Gui exec statements (under // Load up the shell GUIs):
and add after the other script exec statements (under // Client scripts):
Next open the file - C:\GarageGames\torque\example\fps\client\ui\defaultGameProfiles.cs and add this code to the end:
Next open the file - C:\GarageGames\torque\example\fps\server\scripts\commands.cs and add this code to the end:
Next create a new .cs file (blank text file with a .cs extension) and put it in the dir C:\GarageGames\head\torque\example\fps\client\scripts then add the following code as its contents:
The last thing to do know is create the actual gui.
Some Pointers on the Gui....the names on the left side are GuiTextCtrls named Slot1 - Slot11, beside them are Amount1 - Amount11 (They contain the "Amount: 1"). Then I moved the arrow keys over so that they match up with the slots. The Slots have onMouseDown functions so they can change the GuiObjectView (displayWindow) and Desc text (DisplayText) on the right side. New in version 3 - Set the DisplayText profile to CenterInventoryProfile so the text is centered.
Here is a screenshot of my GUI, it should help you out. Inventory version 2 Screenshot
Here is another screenshot with the names and types of the gui controls in red. Inventory version 2 Gui reference
Inventory v.3 Tutorial
Note: This is Inventory v2 but it has been modified to use My new Inventory Manager which is also required for this tutorial. It can be found at Inventory Manager Tutorial. There was a slight change in the game.cs file when I posted this tutorial (Healthkit's type needs to be "healthKit" not "item")
This tutorial will help you create a Graphical Display of the items that the player has on them. To invoke the Gui you press the letter i and press i again to exit it.
The tutorial requires my tutorial (Adding Mouse Events to Gui Controls) it can be found here: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1864
Using the above tutorial, you need to add mouse events to GuiTextCtrl and GuiBitmapCtrl for this tutorial.
Note: This tutorial was done with the head version (but it was a bit old, hopefully nothing has changed that will effect this tutorial) from the CVS. Warning: the C++ code changes ONLY work with the head version since the resManager.cc and resManager.h are from the head version. You can get it to work with non head by modifying your resManager.cc and resManager.h files, but still use the GuiObjectView.cc and GuiObjectView.h in the zip on this page.
This tutorial is a modification of the Inventory Popup Tutorial, so you can find some info on the GUI creation in that tutorial. The dts viewing code was given to me by ExoDuS, he got it from this tutorial - perso.wanadoo.fr/hysteria/docs/guiCtrls.htm You will need the following zip for the tutorial to work (since it was modified from the orginal by ExoDuS for the setEmpty() command) (Code File link at the top of this page). The zip contains the files guiObjectView.cc, GuiObjectView.h (they go in /engine/gui) and resManager.cc, resManager.h (they replace the ones in your /engine/core) Add those to your project and recompile. More on the GUI at the end of this tutorial.
This version of the Inventory has a list of your inventory items on the left and you click on the name of the item to display its model with a description.
Even though this is a modification I am going to show you all of the coding that it takes to complete it. The only file that were modified though were (InventoryGui.cs, commands.cs, and inventory.cs)
First open the file - C:\GarageGames\torque\example\fps\client\scripts\default.bind.cs Go down to the section:
//------------------------------------------------------------------------------ // Item manipulation //------------------------------------------------------------------------------
and add the following code:
$InvState = false;
function toggleInventory() {
if ($InvState == false) {
commandToServer('DisplayInventory');
$InvState = true;
} else {
Canvas.setContent( PlayGui );
$InvState = false;
}
}
moveMap.bindCmd(keyboard, "i", "toggleInventory();", "");Next open the file - C:\GarageGames\torque\example\fps\client\config.cs and add the following line to the end:
moveMap.bindCmd(keyboard, "i", "toggleInventory();", "");
Next open the file - C:\GarageGames\torque\example\fps\client\init.cs and add after the other Gui exec statements (under // Load up the shell GUIs):
exec("./ui/InventoryGui.gui");and add after the other script exec statements (under // Client scripts):
exec("./scripts/InventoryGui.cs");Next open the file - C:\GarageGames\torque\example\fps\client\ui\defaultGameProfiles.cs and add this code to the end:
//-----------------------------------------------------------------------------
// Inventory popup profile
new GuiControlProfile ("InventoryProfile")
{
opaque = false;
fillColor = "128 128 128";
fontColor = "0 0 0";
border = true;
borderColor = "0 0 0";
fontType = "Arial";
fontSize = 18;
};
new GuiControlProfile ("CenterInventoryProfile")
{
opaque = false;
fillColor = "128 128 128";
fontColor = "0 0 0";
border = true;
borderColor = "0 0 0";
fontType = "Arial";
fontSize = 18;
justify = center;
};Next open the file - C:\GarageGames\torque\example\fps\server\scripts\commands.cs and add this code to the end:
//-----------------------------------------------------------------------------
function serverCmdDisplayInventory(%client)
{
%player = %client.player;
//Send the info to the client to display it
commandToClient(%client, 'PopInventory',%player);
}Next create a new .cs file (blank text file with a .cs extension) and put it in the dir C:\GarageGames\head\torque\example\fps\client\scripts then add the following code as its contents:
//-------------------------------------------------
// InventoryGui.cs
//-------------------------------------------------
$invCount = -1;
$CurrentBottomSlot = 11;
new ActionMap(InvMap);
InvMap.bindCmd(keyboard, "i", "toggleInventory();", "");
function InventoryGui::onWake()
{
displayWindow.setEmpty();
DisplayText.setText("");
$enableDirectInput = "1";
activateDirectInput();
InvMap.push();
}
function InventoryGui::onSleep()
{
InvMap.pop();
}
function clientCmdPopInventory(%player) {
//reset the Bottom Slot to default
$CurrentBottomSlot = 11;
$invCount = -1;
//Set the Pointer back to the beginning
if (%player.moveCurPtr("first") == 0) {
echo("Inventory Manager::Pointer error");
return 0;
}
if (%player.getInvItem("current","amount") > 0) {
$invCount++;
$ItemTokens[$invCount] = %player.getInvItem("current","name");
$AmountTokens[$invCount] = %player.getInvItem("current","amount");
$TypeTokens[$invCount] = %player.getInvItem("current","type");
$DescTokens[$invCount] = %player.getInvItem("current","description");
//right now only useful for ammo and healthkit (hackish but required because of the paths for the model viewer)
if (%player.getInvItem("current","type") $= "healthKit")
$strippedItemTokens[$invCount] = "items";
else
$strippedItemTokens[$invCount] = strreplace($ItemTokens[$invCount],"Ammo","");
}
while (%player.moveCurPtr("next") == 1) {
if (%player.getInvItem("current","amount") > 0) {
$invCount++;
$ItemTokens[$invCount] = %player.getInvItem("current","name");
$AmountTokens[$invCount] = %player.getInvItem("current","amount");
$TypeTokens[$invCount] = %player.getInvItem("current","type");
$DescTokens[$invCount] = %player.getInvItem("current","description");
if (%player.getInvItem("current","type") $= "healthKit")
$strippedItemTokens[$invCount] = "items";
else
$strippedItemTokens[$invCount] = strreplace($ItemTokens[$invCount],"Ammo","");
}
}
//This block is copy and pasted 11 times due to the hardcoded GUI names...not
//sure of a better way to do this
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > -1) { //Slot 1
Slot1.setText($ItemTokens[0]);
Amount1.setText("Amount: " @ $AmountTokens[0]);
} else {
Slot1.setText("");
Amount1.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 0) { //Slot 2
Slot2.setText($ItemTokens[1]);
Amount2.setText("Amount: " @ $AmountTokens[1]);
} else {
Slot2.setText("");
Amount2.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 1) { //Slot 3
Slot3.setText($ItemTokens[2]);
Amount3.setText("Amount: " @ $AmountTokens[2]);
} else {
Slot3.setText("");
Amount3.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 2) { //Slot 4
Slot4.setText($ItemTokens[3]);
Amount4.setText("Amount: " @ $AmountTokens[3]);
} else {
Slot4.setText("");
Amount4.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 3) { //Slot 5
Slot5.setText($ItemTokens[4]);
Amount5.setText("Amount: " @ $AmountTokens[4]);
} else {
Slot5.setText("");
Amount5.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 4) { //Slot 6
Slot6.setText($ItemTokens[5]);
Amount6.setText("Amount: " @ $AmountTokens[5]);
} else {
Slot6.setText("");
Amount6.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 5) { //Slot 7
Slot7.setText($ItemTokens[6]);
Amount7.setText("Amount: " @ $AmountTokens[6]);
} else {
Slot7.setText("");
Amount7.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 6) { //Slot 8
Slot8.setText($ItemTokens[7]);
Amount8.setText("Amount: " @ $AmountTokens[7]);
} else {
Slot8.setText("");
Amount8.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 7) { //Slot 9
Slot9.setText($ItemTokens[8]);
Amount9.setText("Amount: " @ $AmountTokens[8]);
} else {
Slot9.setText("");
Amount9.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 8) { //Slot 10
Slot10.setText($ItemTokens[9]);
Amount10.setText("Amount: " @ $AmountTokens[9]);
} else {
Slot10.setText("");
Amount10.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
if ($invCount > 9) { //Slot 11
Slot11.setText($ItemTokens[10]);
Amount11.setText("Amount: " @ $AmountTokens[10]);
} else {
Slot11.setText("");
Amount11.setText("");
}
//////////////////////////////////////////////////////////////////////////////////
Canvas.setContent( InventoryGui );
}
//--------------------------------------------------------------------
// Display function
//--------------------------------------------------------------------
function DisplayItem(%num) {
displayWindow.setModel("fps/data/shapes/" @ $strippedItemTokens[%num] @ "/" @ $TypeTokens[%num] @ ".dts" , "");
DisplayText.setText($DescTokens[%num]);
}
//--------------------------------------------------------------------
// Slot click events
//--------------------------------------------------------------------
function Slot1::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 11);
}
function Slot2::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 10);
}
function Slot3::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 9);
}
function Slot4::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 8);
}
function Slot5::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 7);
}
function Slot6::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 6);
}
function Slot7::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 5);
}
function Slot8::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 4);
}
function Slot9::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 3);
}
function Slot10::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 2);
}
function Slot11::onMouseDown(%this, %obj) {
DisplayItem($CurrentBottomSlot - 1);
}
//--------------------------------------------------------------------
// "Arrow Keys"
//--------------------------------------------------------------------
function UpArrow::onMouseDown(%this, %obj)
{
if ($invCount > 10 && $CurrentBottomSlot > 11) {
$CurrentBottomSlot--;
Shift();
}
}
function DownArrow::onMouseDown(%this, %obj)
{
if ($invCount > 10 && $CurrentBottomSlot < ($invCount+1)) {
$CurrentBottomSlot++;
Shift();
}
}
//-----------------------------------------------------------------
// Shift - shifts the slots
//-----------------------------------------------------------------
function Shift() {
Slot1.setText($ItemTokens[$CurrentBottomSlot-11]);
Amount1.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-11]);
Slot2.setText($ItemTokens[$CurrentBottomSlot-10]);
Amount2.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-10]);
Slot3.setText($ItemTokens[$CurrentBottomSlot-9]);
Amount3.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-9]);
Slot4.setText($ItemTokens[$CurrentBottomSlot-8]);
Amount4.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-8]);
Slot5.setText($ItemTokens[$CurrentBottomSlot-7]);
Amount5.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-7]);
Slot6.setText($ItemTokens[$CurrentBottomSlot-6]);
Amount6.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-6]);
Slot7.setText($ItemTokens[$CurrentBottomSlot-5]);
Amount7.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-5]);
Slot8.setText($ItemTokens[$CurrentBottomSlot-4]);
Amount8.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-4]);
Slot9.setText($ItemTokens[$CurrentBottomSlot-3]);
Amount9.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-3]);
Slot10.setText($ItemTokens[$CurrentBottomSlot-2]);
Amount10.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-2]);
Slot11.setText($ItemTokens[$CurrentBottomSlot-1]);
Amount11.setText("Amount: " @ $AmountTokens[$CurrentBottomSlot-1]);
}The last thing to do know is create the actual gui.
Some Pointers on the Gui....the names on the left side are GuiTextCtrls named Slot1 - Slot11, beside them are Amount1 - Amount11 (They contain the "Amount: 1"). Then I moved the arrow keys over so that they match up with the slots. The Slots have onMouseDown functions so they can change the GuiObjectView (displayWindow) and Desc text (DisplayText) on the right side. New in version 3 - Set the DisplayText profile to CenterInventoryProfile so the text is centered.
Here is a screenshot of my GUI, it should help you out. Inventory version 2 Screenshot
Here is another screenshot with the names and types of the gui controls in red. Inventory version 2 Gui reference
#2
Also by displaying the item and the amount, the underlying code is easier to understand. To display it like you are saying you would have to check the type and if it is a weapon you would have to parse through and get the amount of the ammo that you have. (if you have any at all)
These inventory tutorials have been kinda a work in progress and not really a "final product tutorial." I did it this way so people could get a head start and work through it with me. Everyday Im learning something new about torque and I see things i didn't see before and Im finding easier ways to do things. One thing I have noticed of some people is they simply implement the tutorials and do not understand how the tutorial works. There is some information in these tutorials that can help you out a lot in other situations if you understand how they work. An example of this is the Ammo Hud Tutorial. Even if you do not want this in your game you can gain the following knowledge about torque from reading the tutorial:
1. How to send data from the server to the client through the scripting language.
2. How to create a custom Gui control profile.
3. How to manipulate the GuiTextControl through scripts.
With this information you could make a guitextcontrol that displays other things like health, energy, or whatever. Or you could apply a couple of the things you learned and apply it to something else from another tutorial. And this is all from a small tutorial.
I'm not sure if I ever answered your questions :) so if you have any more after reading this feel free to ask. Hopefully I didn't sound negative or anything like that I just figured i would give a thorough explanation. :)
01/17/2002 (9:55 pm)
I guess that is where I saw a different view than you did. Since I am making a RPG I was thinking in an RPG sense where you can have as many weapons as you want as long as you can hold them. The torque demo only allows one though so i guess this could be a bad design issue but I tried to make it generic and not necessarily for the Torque demo. If I were going to make an inventory for the torque demo then I would do it along the same lines as halflife or Max Payne's inventory is done.Also by displaying the item and the amount, the underlying code is easier to understand. To display it like you are saying you would have to check the type and if it is a weapon you would have to parse through and get the amount of the ammo that you have. (if you have any at all)
These inventory tutorials have been kinda a work in progress and not really a "final product tutorial." I did it this way so people could get a head start and work through it with me. Everyday Im learning something new about torque and I see things i didn't see before and Im finding easier ways to do things. One thing I have noticed of some people is they simply implement the tutorials and do not understand how the tutorial works. There is some information in these tutorials that can help you out a lot in other situations if you understand how they work. An example of this is the Ammo Hud Tutorial. Even if you do not want this in your game you can gain the following knowledge about torque from reading the tutorial:
1. How to send data from the server to the client through the scripting language.
2. How to create a custom Gui control profile.
3. How to manipulate the GuiTextControl through scripts.
With this information you could make a guitextcontrol that displays other things like health, energy, or whatever. Or you could apply a couple of the things you learned and apply it to something else from another tutorial. And this is all from a small tutorial.
I'm not sure if I ever answered your questions :) so if you have any more after reading this feel free to ask. Hopefully I didn't sound negative or anything like that I just figured i would give a thorough explanation. :)
#3
heres how mine looks so far
01/18/2002 (9:13 am)
i understand where you are comming from totaly, this is how i learn about the codeing of engines (not just torque) by doing tuts i find over and over again then modifing and re modifing to learn what is exactly happening , eventualy i wll end up with whats in my minds eye , dont get me rong , i didnt know how to add textctrl and all that stuff before your first tut came along ,so really it is doing me some good , i just didnt uderstand your point of veiw ,,,,keep up the good work.heres how mine looks so far
#4
01/18/2002 (1:37 pm)
Cool. I'm glad to see that you are making your's different, I think the exploration to be able to change it will help you out and you may learn some new things through it.
#5
No reason to embed that in the output of every line.
Also, for people using it, the script strings "amount" or "Ammo" would be customized to your specific game.
d
01/20/2002 (12:55 pm)
You could also just make titles for the column, and let numbers represent whatever text you put in the header of the column. It might be Amount or Ammo in a 'charge based' system, or it might be Weight or Value in an RPG game (value in Gold Pieces, of course!).No reason to embed that in the output of every line.
Also, for people using it, the script strings "amount" or "Ammo" would be customized to your specific game.
d
#6
I'm not sure about the gui-type-object to start with.
Tim, could you maybe post the first few lines of the Inventory.gui so I can see how it starts.
Shall I make the gui with the ingame gui editor, or is there a better way?
03/19/2002 (5:38 am)
I've gone through the tutorial, but I don't seme to understand the GUI setup. I'm not sure about the gui-type-object to start with.
Tim, could you maybe post the first few lines of the Inventory.gui so I can see how it starts.
Shall I make the gui with the ingame gui editor, or is there a better way?
#7
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1842
03/19/2002 (5:47 am)
he explained it reasl well in the first tut he did (at the end of the tut)http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1842
#9
03/21/2002 (8:32 am)
Somewhere along the way, I must have done somthing wrong..The Gui works now (Thx Gary), but I cannot picup any objects. Where could I have goofed?
#10
03/21/2002 (9:58 am)
i realy couldnt say ive only done 1 and 2 then got side tracked on ther stuff
#11
only for the hosting client, all other clients get:
07/07/2002 (10:57 am)
Hm, this doesn't work in Multiplayer mode...only for the hosting client, all other clients get:
fps/client/scripts/InventoryGui.cs (35): Unable to find object: '1867' attempting to call function 'moveCurPtr' Inventory Manager::Pointer error
#12
Has anyone else had problems doing this tutorial since 1.1.2?
Here are my errors: (first 8 of 17)
game.cc
e:\garage_bin\torque\engine\game\game.cc(235) : error C2039: 'dumpLoadedResources' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
gameConnection.cc
e:\garage_bin\torque\engine\game\gameconnection.cc(940) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(941) : error C2039: 'clearMissingFileList' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(950) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(966) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(971) : error C2039: 'getMissingFileList' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(976) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(990) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
Any ideas? Thanks in advance!
Glenn Connery
12/23/2002 (5:14 pm)
I recently tried this, and during the compile process, I received quite a few errors (17 in all). Not sure what I did wrong. I bought the Torque SDk in November 2002 and perhaps this tutorial is outdated? I'm thinking these resManager (.cc & .h) files are not as easily replaceable as the ones from a prior Torque version (1.1.1)?Has anyone else had problems doing this tutorial since 1.1.2?
Here are my errors: (first 8 of 17)
game.cc
e:\garage_bin\torque\engine\game\game.cc(235) : error C2039: 'dumpLoadedResources' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
gameConnection.cc
e:\garage_bin\torque\engine\game\gameconnection.cc(940) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(941) : error C2039: 'clearMissingFileList' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(950) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(966) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(971) : error C2039: 'getMissingFileList' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(976) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
e:\garage_bin\torque\engine\game\gameconnection.cc(990) : error C2039: 'setMissingFileLogging' : is not a member of 'ResManager'
e:\garage_bin\torque\engine\core\resmanager.h(241) : see declaration of 'ResManager'
Any ideas? Thanks in advance!
Glenn Connery
#13
01/09/2003 (4:48 pm)
yep got that too.. weird...
#14
(sorry if u've read this Q 2ice.)
09/10/2003 (11:05 pm)
How could one display the inventory on another monitor...either by creating a seperate window or by spanning the game across 2 monitors?(sorry if u've read this Q 2ice.)
#15
I do have a question in hopes that someone can help me out...
With the latest head, the Con::addCommand have been depreciated for the new and improved ConsoleMethod. However, my experience with c++ isn't strong enough to know how to change and implement the console commands using ConsoleMethod... would anyone here be willing to post an example or two on how to change them? For example:
How should that be defined using the new ConsoleMethod?
Thanks bunches!
R
11/14/2003 (9:02 am)
Great resource!I do have a question in hopes that someone can help me out...
With the latest head, the Con::addCommand have been depreciated for the new and improved ConsoleMethod. However, my experience with c++ isn't strong enough to know how to change and implement the console commands using ConsoleMethod... would anyone here be willing to post an example or two on how to change them? For example:
static void cAddInvItem(SimObject *ptr, S32 argc, const char **argv)
{
Player *obj = static_cast<Player*>(ptr);
obj->inv.AddItem((char*)argv[2], (char*)argv[3], (char*)argv[4], (char*)argv[5],(char*)argv[6]);
}
Con::addCommand("Player", "addInvItem", cAddInvItem, "obj.addInvItem(name,amount,type,description,max)", 7, 7);How should that be defined using the new ConsoleMethod?
Thanks bunches!
R
#16
ConsoleMethod(Player, addInvItem, void, 7, 7, "obj.addInvItem(name,amount,type,description,max)")
{
object->mInventory.AddItem((char*)argv[2], (char*)argv[3], (char*)argv[4], (char*)argv[5],(char*)argv[6]);
}
06/17/2004 (9:00 pm)
Ryan, just playing with the inventory manager today so sorry not to have helped before, but maybe it will help others, here is the conversion of the cAddInvItem :ConsoleMethod(Player, addInvItem, void, 7, 7, "obj.addInvItem(name,amount,type,description,max)")
{
object->mInventory.AddItem((char*)argv[2], (char*)argv[3], (char*)argv[4], (char*)argv[5],(char*)argv[6]);
}
#17
08/31/2004 (7:47 am)
does Inventory v3. support drag and drop ? :)
#18
has anyone the ideas for a sort algorithm of types?
this way we can get an output with the item types in squence and then i will add headers so the its a prettier interface.
if anyone wants to hepl or just post a nice sort algorithm it would be appreciated
i am also adding a "weight" feature like common rpg's so you can only pick up items upto a certain weight limit.
and a drop feature is beign added to the interface.
12/29/2004 (3:09 pm)
i am trying to expand this to sort the LList eg by type so the weapons come first then the items etchas anyone the ideas for a sort algorithm of types?
this way we can get an output with the item types in squence and then i will add headers so the its a prettier interface.
if anyone wants to hepl or just post a nice sort algorithm it would be appreciated
i am also adding a "weight" feature like common rpg's so you can only pick up items upto a certain weight limit.
and a drop feature is beign added to the interface.
#19
02/28/2005 (4:31 pm)
Anyone tried this on 1.3 yet?
#20
03/05/2005 (11:43 pm)
The new ResManager doesn't work for me in 1.3, :( 
Torque Owner Ace
Rifle 50
crosbow 50
healthkits 3
the numbers being the ammo reference, i think it would save on alot of confuzion.
i know this is basicly generic, but since i am a newbie with script ,it basicly takes me days to figger out what you could do in hours, any way just wanted to let you know that these tuts are very confuzing from a newbies veiw point.