Text MDL Commands

Discussion area for user-created Allegiance models, textures, voicechats, music, and other ingame content.
Post Reply
Andon
Posts: 5453
Joined: Sun Jun 03, 2007 8:29 pm
Location: Maryland, USA
Contact:

Post by Andon »

I am in the process of making a new HUD - It is mostly complete, but In order to finish it how I want to finish it, I need to know how to either truncate things or use less than and greater than.

I've tried using < and > but it seems to recognize them about as much as it recognizes +, -, /, and *. Because you have to type out those operators, I tried doing Truncate(), LessThan() and GreaterThan(), but I'm about as likely to stumble upon the correct one with capitalization as I am likely to win the lottery.

Any useful help is apreciated
Image
ImageImage
Cortex
Posts: 2578
Joined: Sun Nov 28, 2004 8:00 am
Location: Germany
Contact:

Post by Cortex »

There's no possible way of working on MDL without Ksero's excellent MDL Documentation.

I didn't immediately see something like LessThan(), but you could use Subtract() to subtract B from A, then Max() it with 0 and compare using a SwitchX(). That is because ...

Code: Select all

(B <= A) <=> (max(A - B, 0) = 0)
... if I'm not mistaken.

Yes, MDL sometimes is funny like that. :)


-- Cort

EDIT: Duh, I meant without Ksero's docs, of course!
Last edited by Cortex on Wed Dec 03, 2008 12:42 pm, edited 1 time in total.
Image
This is Sparta. Not spa. — Wurf
Image
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

yes MDLing is the art of doing simple things using complex tricks :lol:

to be complete, Ksero's doc is missing 3 R4 additions :

in "gamepanes" namespace:

Code: Select all

MapPreviewPane
//  MapPreviewPane(image, bshowdetails, bshowside)
//     image = background image on which the preview will be rendered. So image also sets the size of the pane.
//     bshowdetails = bool, if true displays map details whern the mouse is over the pane
//     bshowside = bool, if true displays the side arrow(s) on the map

TextButtonBarPane
// TextButtonBarPane(ColumnOffsets, ColumnHeaders, ButtonFaces, bActAsTabs);
//     ColumnOffsets = list of numbers (X offsets)
//     ColumnHeaders = list of column headers (names aka strings)
//     ButtonFaces = button style (one of: Button* style)
//     bActAsTabs =  bool, if true the bar will act as a tabbed pane
// exemple of it: gamescreen.mdl , used for the "create game" dialog
in 'model' namespace:

Code: Select all

Camera
// Camera(zclip_near,zclip_far,FOV_in_degrees,position_vector)
//   zclip_near = number, Z  near clipping value
//   zclip_far = number, Z far clipping value
//   FOV_in_degrees = number, field of view in degrees
//   position_vector = VectorValue, camera position
Image
Cortex
Posts: 2578
Joined: Sun Nov 28, 2004 8:00 am
Location: Germany
Contact:

Post by Cortex »

KGJV wrote:QUOTE (KGJV @ Dec 3 2008, 11:15 AM) yes MDLing is the art of doing simple things using complex tricks :lol:
So true! :D
KGJV wrote:QUOTE (KGJV @ Dec 3 2008, 11:15 AM) in 'model' namespace:

Code: Select all

Camera
// Camera(zclip_near,zclip_far,FOV_in_degrees,position_vector)
//   zclip_near = number, Z  near clipping value
//   zclip_far = number, Z far clipping value
//   FOV_in_degrees = number, field of view in degrees
//   position_vector = VectorValue, camera position
That's interesting, where is that used? Could I maybe now create a second, independent camera to show the targeting view over the map. (That's currently not possible because the map view seems to do almost nothing less than moving the camera high above the sector. And there's only one camera, so displaying the targeting view there means it will get the same camera as the map.)


-- Cort
Image
This is Sparta. Not spa. — Wurf
Image
Andon
Posts: 5453
Joined: Sun Jun 03, 2007 8:29 pm
Location: Maryland, USA
Contact:

Post by Andon »

Alright, managed to do it with Cort's help:

Code: Select all

AmmoPercent = Multiply(100, GetAmmo(Me, OnEveryFrame));

AmmoImage = 
    
        StringImage(
                    JustifyCenter,
                    250,
                    lgBoldVerdana,
                    hudColor,
                    ConcatinatedString(ConcatinatedString("Ammo: ", NumberString(AmmoPercent)), "%")
);

AmmoLowImage = 
    
        StringImage(
                    JustifyCenter,
                    250,
                    lgBoldVerdana,
                    Color(1, 0, 0),
                    ConcatinatedString(ConcatinatedString("Ammo: ", RealNumberString(AmmoPercent)), "%")
);

AmmopctImage =
    SwitchImage(
        Max(Subtract(AmmoPercent, 11), 0),
        AmmoImage,
        [
            (0, AmmoLowImage)
        ]
    );
That little thing, from my HUD, will show the percent of ammo left, but if it gets to be 10% or less, it will turn red and show a more precise percent.
Image
ImageImage
badpazzword
Posts: 3627
Joined: Thu Jan 12, 2006 8:00 am
Contact:

Post by badpazzword »

There's still no way to get real numbers instead of percentages, is there?
Have gaming questions? Get expert answers! Image Image
Andon
Posts: 5453
Joined: Sun Jun 03, 2007 8:29 pm
Location: Maryland, USA
Contact:

Post by Andon »

Not from what I've tried.
Image
ImageImage
fufi
Posts: 297
Joined: Sat Apr 05, 2008 7:26 pm
Contact:

Post by fufi »

-frank- huzzling "... what are you talking about? command lines are that long now?"
Last edited by fufi on Tue Dec 09, 2008 1:34 pm, edited 1 time in total.
Post Reply