Tuesday, November 17, 2015

Creating a Listbox ARMA 3

I know it has been a long while since I've updated this but I got a job so I'm super busy. Between work and keeping my girlfriend happy there isn't much time for personal development. So lets get to it.

Listbox, what is it? what does it do? 

A listbox basically presents text in a nice little box that is organized but with extra features. For example depending on what you select it can create an event to happen. For this tutorial I'm going to show just how to create one and add something to the list. I'm not going step by step in creating one like I did in my previous post "G.U.I Button ARMA 3 Style". If you are ever lost or need a refresher refer to that post and catch up.

1. Start up ARMA 3 and select Editor and select any map it doesn't matter and create a new mission.

2. Save the mission. It can be anything you want but remember the name.

3. Once you save it, place one playable unit down and click preview.

4. Inside the game press escape and look for GUI EDITOR on the bottom and select it.

5. I'm going to skip ahead and not break it down Barney Rubble style on how I created the listbox. But I will show you what it looks like.


This is what I created using the GUI editor. I added a RscFrame, RscListBox, 2 RscButton, and RscText.

6. Now once I created this I need to save the information. Shift + Ctrl + S, paste this information into a empty text document. Hopefully you are using Notepad++. Save it any name you want and you're almost done. I named my file RangeGUI.hpp. Eventually I want to create ranges on the island of Stratis.


This is what it looks like after I made changes. Remember from my last post I had to add a couple of hings to make this work. Take a look at the comments in the picture for more information.


7. Now to get the listbox to work correctly I had to add a couple of things to this. Noticeably is the onLoad command. This basically tells ARMA 3 whenever this dialog is created load this script. rangeScript.sqf is what makes the listbox to work. Pay attention to the idd variable and the idc variable under Rex_Title.

8. Now in the description.ext I have to define the parent config and my config so ARMA can display the listbox.

9. Now I create a sqf file called "rangeScript.sqf". In this file I basically add text to the listbox. Look in the comments in the picture for more details.

10. Hopefully the picture above explains how to make the listbox works. Basically I have to find the display. I used the findDisplay command and give it the idd number 2017 which I defined. Once I have the display I need access to the control for the listbox. Using displayCtrl command I passed the idc number I defined for the listbox. Refer to the pictures in case you're confused. displayCtrl returns a control data type which gives me more access to the listbox. Now I need to add something to the listbox. lbAdd command is what I used to add a simple text to the listbox. To add further flare to the text I set the color to green. Refer to the picture above for more details.

11. Now that script is defined it is time to test it out. Load up the mission and place down a unit you can control and a pole and edit the initialization of it to this.
12. Preview the mission and run straight to the pole and activate the addAction. You should see something similar to this.

So far nothing has been added to make anything to happen, basically the box is there. I'll show you in the next tutorial how to make the magic happen.

This concludes this tutorial.

No comments:

Post a Comment