russian armor

[SCAR] UI Control API

22 Aug 2015, 17:26 PM
avatar of eliw00d
Honorary Member Badge

Posts: 755 | Subs: 7

Relic recently introduced UI Control, which allows modders to create custom UI in SCAR. While working on the custom UI for our mod, Fortress Europe, I came up with an API that made using the UI Control much faster and simpler. I decided to polish it a little bit and release it publicly, for others to benefit from.

It is based on Object Oriented Programming, so it is very versatile. You can create sub classes that inherit from my classes, if you would like. This will allow you to create many different kinds of elements for your custom UI.

The Documentation is a work-in-progress, and I am open to Pull Requests on GitHub.


Here is a brief overview of the UI Control API. I will make a more in-depth video at some point.

22 Aug 2015, 23:38 PM
avatar of IronMedic

Posts: 318

To use localised strings your mod needs, a burn folder containing a "language".ucs

Example localised strings for english.ucs

1 Incendiary Cluster Bomb
2 IncendiaryClusterBomb

To references a localised string replace the string whit "$uniqueModID:lineInLocaleLanguageFile".
The example below references the third line/string in the local "language".ucs.

g_textString = "$3106b71c884f41eaa8434de9c91bf9cc:3"
23 Aug 2015, 00:04 AM
avatar of eliw00d
Honorary Member Badge

Posts: 755 | Subs: 7

I did not know it would work with a string, thanks!
23 Aug 2015, 18:18 PM
avatar of eliw00d
Honorary Member Badge

Posts: 755 | Subs: 7

Turns out the Relic functions do the type checking for you, so you can pass the setText functions an Integer or a String with the following formats:



I have updated the code as a result.
23 Aug 2015, 20:44 PM
avatar of eliw00d
Honorary Member Badge

Posts: 755 | Subs: 7

I have added a Wiki:


Detailed descriptions for methods coming soon, but it should get you started.
3 Sep 2015, 21:05 PM
avatar of eliw00d
Honorary Member Badge

Posts: 755 | Subs: 7

Added a temporary fix to the Label class's setFontSize method, which should help with Labels getting offset downwards, leading to cut off. Set size and location first, and font size last. Height should be 1:1 with the font size for this to work.

An example:
label = Label("Label");
label.setSize(128, 16);
label.setLocation(8, 8);
label.setFontSize(label.getHeight() or 16);

Let me know if there are any issues. Otherwise, let's hope that Relic fixes the issue!
18 Nov 2015, 16:52 PM
avatar of eliw00d
Honorary Member Badge

Posts: 755 | Subs: 7

I have just uploaded Version 2.0, which adds a new Class function and changes the syntax of method calls. I also cleaned up the code quite a bit, which should improve performance and efficiency.

An updated example:

label = Label("Label");
label:setSize(128, 16);
label:setLocation(8, 8);
label:setFontSize(label.getHeight() or 16);

The change from . to : is due to the methods hiding the self variable. For those not familiar with this syntax:

function Label:setSize(width, height)

is the same as

function Label.setSize(self, width, height)

So, you should only have to update your own code to reflect the change in syntax, the rest should be the same.

Please let me know if you have any questions or concerns. Thanks and enjoy!
1 user is browsing this thread: 1 guest
64 bit beta
Event in Progress

Ladders Top 10

  • #
    Steam Alias
Data provided by Relic Relic Entertainment

Replay highlight

  • Ostheer flag Scotch
  • Oberkommando West flag VonAsten
  • U.S. Forces flag [NS] aerafield
  • U.S. Forces flag T.R. CrossFire
uploaded by aerafield

Board Info

236 users are online: 5 members and 231 guests
Crecer13, -HOI-jimmy890, Spanky, Cyanara, Nashka
39 posts in the last 24h
341 posts in the last week
1901 posts in the last month
Registered members: 20667
Welcome our newest member, Dealmeidase50v
Most online: 1221 users on 25 Feb 2020, 12:03 PM