No announcement yet.

Mutator Config Textbox?

  • Filter
  • Time
  • Show
Clear All
new posts

    Mutator Config Textbox?

    Would anybody happen to know how to script a textbox for a mutator so that I can input a class? I'm using this for testing purposes, pretty much I need a box which I can type any class I want, and when the game starts, the mutator will call a function from the class I specified. I guess a drop-down box might work, but I'd prefer a textbox because I will be testing many unrelated files in different packages with this mutator, and since all of my classes directly extend 'Object', it will end up listing every class in the game.

    Edit: Another quick thing (I don't feel like starting a new thread): UnrealWiki documents the use of conditional operators, similar to those used in C++. Using the same format of the wiki page, I tried something simple:
    local int a, b, c;
           a = 2;
           b = 7;
           c = a>b ?? a : b;
    But for some reason, I get a "Type mismatch in '='" at the conditional operator line. What is wrong with it?

    One last question, how do I have a function with 1 parameter that allows any type? Like let's say I have a function called doeetNow, how would I set it up so that I could pass any type of parameter I wanted to it, so I could do doeetNow(5.5), doeetNow(1), doeetNow(true), doeetNow("Hello!"), etc. because what the function does is take the input and changes it to a string, then sends the string through other stuff, and I don't want to keep putting string() around all of my variables.


      To the first question:
      What do you mean? Do you want a textbox in the mutator-configuration-menu? If so, then look HERE.
      Basically you need a configurable string value in your mutator-class and something in the FillPlayInfo()-function, as descriped in the link.
      If done correctly, you should get a textbox in the mutator-config-menu.

      If you mean ingame, then you need to create an own menu and use a "moEditBox" (with a text before the actual text-box) or a "GUIEditBox" (just a simple text-box) and embed it into your custom menu.
      Look at the UT2004-source code; there are plenty of menus which show how to create a menu. Another good resource is the UTComp-script-source.

      Btw, the correct objects for a drop-down box are "moComboBox" and "GUIComboBox".

      To the second question:
      Quote from unrealwiki:
      The conditional operator ?? (only in Devastation) can be used as a shorthand for what would normally be single line if .. then .. else blocks.
      Thus UT2004 doesn't support it.

      For your third question: You can use the following syntax to automatically convert any object to a string:
      function DoSomething(coerce string MyVar)
      "Coerce" automatically tries to convert the input into the specified type.


        Thanks a lot, that's exactly what I needed. Guess I need to learn to read better, too.


          Originally posted by D-Hunter View Post
          Thanks a lot, that's exactly what I needed. Guess I need to learn to read better, too.

          try to download a mutator what youu want and make sure it is umod so you can edit it