Jump to content
Diaverso Carrasco

Run script in RscListbox GUI

Recommended Posts

Hi, I'm trying to create a teleportation GUI, to different positions.

 

have this for the GUI:

class tele
{
	idd = 200; // ID del display
	onLoad = "[] spawn {execVM 'ListBox';};"; // esto se lanza al cargar
	
class controls { // contenido del dialog
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by Cbo.Diaverso Carrasco, v1.063, #Bomudi)
////////////////////////////////////////////////////////
class tele_picture: RscPicture
{
	idc = 1200;
	text = "#(argb,8,8,3)color(1,1,1,1)";
	x = 0 * GUI_GRID_W + GUI_GRID_X;
	y = 0 * GUI_GRID_H + GUI_GRID_Y;
	w = 40 * GUI_GRID_W;
	h = 25 * GUI_GRID_H;
};
class tele_Listbox: RscListbox
{
	idc = 1500;
	x = 1 * GUI_GRID_W + GUI_GRID_X;
	y = 4 * GUI_GRID_H + GUI_GRID_Y;
	w = 9 * GUI_GRID_W;
	h = 16 * GUI_GRID_H;
};
class tele_button: RscButton
{
	idc = 1600;
	text = "Teletransporte"; //--- ToDo: Localize;
	x = 24.5 * GUI_GRID_W + GUI_GRID_X;
	y = 6.5 * GUI_GRID_H + GUI_GRID_Y;
	w = 7 * GUI_GRID_W;
	h = 3.5 * GUI_GRID_H;
};
class tele_cancel: RscButton
{
	idc = 1601;
	text = "Cancelar"; //--- ToDo: Localize;
	x = 24.5 * GUI_GRID_W + GUI_GRID_X;
	y = 13.5 * GUI_GRID_H + GUI_GRID_Y;
	w = 7 * GUI_GRID_W;
	h = 3.5 * GUI_GRID_H;
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////
};
};

The ListBox file have to change the names inside the ListBox

disableSerialization;

_display = findDisplay 200; 

_listBox = _display displayCtrl 1500; 

_listBox lbAdd "Ejemplo1"; 

Script to teleport

this addAction{ 
(_this select 1) setPos (getMarkerPos "formacion/arsenal");
{ _x setPos (getPos (_this select 1)); } forEach units group (_this select 0);
}];

The problem I have is that I don't know how to do that every time you select an option from the list and hit the teleport button, it loads the script

Share this post


Link to post
Share on other sites

I'm not sure what you are asking but you can call script everytime listbox item is selected:

 

 

class tele_Listbox: RscListbox 

{

idc = 1500; 

x = 1 * GUI_GRID_W + GUI_GRID_X; 
y = 4 * GUI_GRID_H + GUI_GRID_Y; 
w = 9 * GUI_GRID_W; 
h = 16 * GUI_GRID_H; 

onLBSelChanged = "params ['_control', '_selectedIndex'];  hint format['index %1 selected!',  _selectedIndex ]; ";

};

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×