Author Topic: GUI Issue  (Read 3042 times)

Hello, I'm having some trouble making a GUI. There are no errors and it runs but when I press the button to open the GUI it doesn't work. Here is my code



Client.cs
Quote
exec("./PipOS1.gui");

    $remapDivision[$remapCount] = "FalloutRPG";
    $remapName[$remapCount] = "PipOS Open";
    $remapCmd[$remapCount] = "Open_PipOS1";
    $remapCount++;



PipOS1.gui
Quote
//--- OBJECT WRITE BEGIN ---
new GuiControl(PipOS2) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   enabled = "1";
   visible = "1";
   clipToParent = "1";

   new GuiWindowCtrl(MainWindow) {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "0 0";
      extent = "623 475";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      accelerator = "escape";
      text = "PipOS A1  [Model 2051]";
      maxLength = "255";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "0";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      minSize = "50 50";
      closeCommand = "canvas.popDialog(PipOS2);";
   };
   new GuiBitmapButtonCtrl(MainButton) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "14 30";
      extent = "140 30";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      text = "                Inventory";
      groupNum = "-1";
      buttonType = "PushButton";
      bitmap = "base/client/ui/tab1";
      lockAspectRatio = "0";
      alignLeft = "0";
      alignTop = "0";
      overflowImage = "0";
      mKeepCached = "0";
      mColor = "0 255 0 255";
   };
   new GuiBitmapCtrl(white) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "11 61";
      extent = "602 405";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      bitmap = "Add-Ons/Client_PipOS/Client_PipOS/Icons/white";
      wrap = "0";
      lockAspectRatio = "0";
      alignLeft = "0";
      alignTop = "0";
      overflowImage = "0";
      keepCached = "0";
      mColor = "255 255 255 255";
      mMultiply = "0";
   };
   new GuiBitmapCtrl(Grey) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "10 61";
      extent = "603 40";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      bitmap = "Add-Ons/Client_PipOS/Icons/Grey";
      wrap = "0";
      lockAspectRatio = "0";
      alignLeft = "0";
      alignTop = "0";
      overflowImage = "0";
      keepCached = "0";
      mColor = "255 255 255 255";
      mMultiply = "0";
   };
   new GuiBitmapButtonCtrl() {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "156 30";
      extent = "156 30";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      text = "                      Stats";
      groupNum = "-1";
      buttonType = "PushButton";
      bitmap = "base/client/ui/tab1";
      lockAspectRatio = "0";
      alignLeft = "0";
      alignTop = "0";
      overflowImage = "0";
      mKeepCached = "0";
      mColor = "255 255 255 255";
   };
      function Open_PipOS1(%toggle)
{
   if(%toggle)
   {
      if(PipOS1.isAwake())
      {
         canvas.popDialog(PipOS1);
      }

      else
      {
         canvas.pushDialog(PipOS1);
      }
   }
}
};



//--- OBJECT WRITE END ---

Thanks for helping me!

The gui name at the top says pipos2 it should be pipos1 instead

Thanks, fixed all the issues!

I have one more request. How do you display variables in a GUI. I know its like text = "Blah Blah Blah"; but adding a variable at the end of Blah Blah Blah (Looks like this text = "Blah Blah Blah" %ewnfl) doesn't work! I need to know for displaying please!

text = "Blah blah blah" @ %ewnfl;

Tried, it didn't work. I think its because I'm not sending the information about the variables. So yea, need to know how to do that.

I have one more request. How do you display variables in a GUI. I know its like text = "Blah Blah Blah"; but adding a variable at the end of Blah Blah Blah (Looks like this text = "Blah Blah Blah" %ewnfl) doesn't work! I need to know for displaying please!

it's called concatenation, in TorqueScript here are the most important syntaxical structures:

@, this will put whatever the two strings are, right next to each other
TAB, this will put a tab in between the two strings, and separate fields
SPC, this will put a space in between the two strings

Uses of each:

text = "Lol" @ "Hey man!";
This would result in: "LolHey man!"

text = "Lol" TAB "Hey man!";
This would result in: "Lol" ^ "Hey man!" or "Lol   Hey man!"

text = "Lol" SPC "Hey man!";
This would result in: "Lol Hey man!"

The mod is client side btw. So do I have to send variable info through script?

The mod is client side btw. So do I have to send variable info through script?
I'm confused what you mean

If you need variables that are stored in the server mod, yes, you have to send them to the client manually.



Can you give me an example? I'm starting to get it.

Theres plenty of tutorials for that already, just do a search.

Can you give me an example? I'm starting to get it.

server code:
function sendClientInfoToClient(%client,%variable)
{
    commandToClient(%client,'updateVariable',%variable);
}


client code:
function clientCmdupdateVariable(%variable)
{
    echo(%variable);
}

So doing that with my variables and then putting the variable in a GUI. It should work?