Developer Store
Support
Member Forums

Screenshots
FAQ
Documentation
License
Known Issues
Downloads

MMOWorkshop BACK!

PyTorque
TGB Web Browser


DarkBaneStudios

hallsofvalhalla - Been A while
J.C. Smith - The Repopulation - 0.5.2 Build Notes
EmpireGames - Elementals in Rise of Heroes
Empire Games - WarPath.
jaidurn - Warcall 0.0.1.0 build notes
medafor - Final detailing of models
Thamior - Presence system GONE! [May 25th 2009)]
Wolf Dreamer - Vista users how to do it
... MORE BLOGS!

[3dFoin] Sorceress and April Sal...
Still here
Does the kit support Torque 3d 2...
A couple of questions about the ...
Stuck at Creating Your MMO Proje...
First person shooter inside TMMO...
Jumping in all over again and ha...
Linking Zones
createdb.py
types and kinds of lighting?

Introduction

As a part of the documentation work I want to do when I work on a project I am providing some GUI information. Just as a note I am very new to this kit and don't know all of its routines yet. If you know a better way to do something or if something I am doing is insecure please let me know. If you make future modifications and wish to update this WIKI please do so. Thanks

--Xerves

Sample Mob Stat GUI

This GUI screen will provide stats for a Mob that is located in the same zone as you. You do not need to be clicking on the mob, but you will need the full name. It will return the first "instance" of the mob. Future modifications will include some more options to see 2.mob or 3.mob. Everything will be included that is needed, but I suggest you try to create the GUI in torque yourself to get a handle on how this all works.

Download the files

GUIDocs.zip

You will find 2 files here that you will need. One is the GUI code for Torque, the other is for the client.

Modifications

Follow these steps to get the new GUI window implemented.

1. Open up the following file:

starter.mmo/client/init.cs

Find the following:

   exec("./ui/ResurrectionGui.gui");
   exec("./ui/VaultWnd.gui");
   exec("./ui/lostPasswordDlg.gui");
   exec("./ui/FriendsWnd.gui");
   exec("./ui/CharRenameWnd.gui");
   exec("./ui/TgtDescWnd.gui");

Immediate afterwards add the following line:

   exec("./ui/MSTATWnd.gui");

2. In the following folder

   starter.mmo/client/ui/

Add the following file from the zip file to the folder

   MSTATWnd.gui

3. In the following folder

   mud/client/gui/

Add the following file from the zip file

   mstatWnd.py

While in the same folder open up init.py and add the following to the end

   import mstatWnd

4. Open the following file

   mud/client/playermind.py

We are going to add some code that is sent to the client to execute the immortal command mstat. To do that find the following code:

    def remote_openNPCWnd(self,title,banker=False):
        TGEObject("NPCWnd_Window").setText(title)
        from gui.npcWnd import NPCWND        
        NPCWND.openWindow(self.perspective, title,banker)
    def remote_closeNPCWnd(self):
        from gui.npcWnd import NPCWND
        NPCWND.closeWindow()

Immediately after it add the following:

    def remote_openMSTATWnd(self,mstats):
        from gui.mstatWnd import MSTATWND      
        # Opens the window with the mob's name as the Title
        MSTATWND.openWindow(self.perspective, mstats[5])
        # Sets all the text in the window based on the array passed
        MSTATWND.setText(mstats)
    def remote_closeMSTATWnd(self):
        from gui.mstatWnd import MSTATWND
        MSTATWND.closeWindow()

5. Open up the following file:

    mud/world/immortalcommand.py

We are going to add the mstat command in so you can type the following command to stat a mob

    /imm mstat <name of mob>

To get started find the following code

    def CmdReloadCommands(mob,args):
       reload(sys.modules['mud.world.command'])

After it add the following function

def CmdMSTAT(mob,args):
    #combines the mob name so it isn't parsed
    mname = ' '.join(args)
    # find all of the active mobs in the zone
    for omob in mob.zone.activeMobs:
        # Compare lower case to lower case
        if (omob.name.lower() == mname.lower()):
           # Initialize the mob so the mob will have proper max health values.
           if not omob.player:
              if not omob.mobInitialized:
                  omob.initMob()
           # this might not be the best method, but the client side doesn't have access to this data so an array is used and passed
           mstats = {}
           mstats[0] = omob.health
           mstats[1] = omob.maxHealth
           mstats[2] = omob.mana
           mstats[3] = omob.maxMana
           mstats[4] = omob.level
           mstats[5] = omob.name
           mstats[6] = omob.str
           mstats[7] = omob.dex
           mstats[8] = omob.ref
           mstats[9] = omob.agi
           mstats[10] = omob.wis
           mstats[11] = omob.bdy
           mstats[12] = omob.mnd
           mstats[13] = omob.mys
           mstats[14] = omob.pre
           mstats[15] = omob.armor
           mstats[16] = omob.offense
           mstats[17] = omob.defense
           mstats[18] = omob.race.name
           mstats[19] = omob.pclass.name
           # Checks for 2nd and 3rd classes
           if (omob.sclass):
              mstats[20] = omob.sclass.name
           else:
              mstats[20] = ""
           if (omob.tclass):
              mstats[21] = omob.tclass.name
           else:
              mstats[21] = ""
           mstats[22] = omob.slevel
           mstats[23] = omob.tlevel
           mstats[24] = omob.stamina
           mstats[25] = omob.maxStamina
           mstats[26] = omob.sex
           # Calls the client to execute the mstat window open command
           mob.player.mind.callRemote("openMSTATWnd",mstats)
           break

Near the bottom of the file find the following code:

COMMANDS['WORLDAGGRO']=CmdWorldAggro
COMMANDS['MYAGGRO']=CmdMyAggro
COMMANDS['SYSMSG']=CmdSystemMsg

After it add the following

COMMANDS['MSTAT']=CmdMSTAT

6. Compile using the IDE and launch the game. Login as an immortal and use the following command on a mob in the zone you are in. Replace the <name of mob> with the actual name of the mob without the < > around it.

   /imm mstat <name of mob>

Creating your own GUI

A gui was provided to you and you can open the GUI editor (Ctrl+F10) and edit it or take a look at it. If you wish to create your own GUI there are a few things you need to know.

1. The following code needs to be MANUALLY added to the end of any new GUI screen

//--- OBJECT WRITE END ---
PyExec("mud/client/gui/mstatWnd.py"); 

This will execute the python code that takes care of the GUI. If you fail to do this your code simply will not work.

2. I used GUIMLTextCtrl for my Text Controls. This allows color to be used in the text (see the mstatWnd.py file provided for how to do this).

3. The Gui Window Control created needs the close command sent which is

closeCommand = "canvas.popDialog(MSTATWnd);";

This will close the window once it is done. Change the name to the name of your Window.

4. When adding items to your window make sure to right click on the guiwindowctrl object before you add it. You should notice the window turn yellow. This will actually place the item inside the window, otherwise it will not move with the window :-(.