moComboBox problem.

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Raven

Member
Jan 17, 2004
147
0
16
40
turniej.unreal.pl
Some time ago, I start modding to UE2 Runtime. First I want to add difficulty combobox. And there Is a problem. I don't know why, my cobo box is empty. Can anyone help me? Here is a code:

Code:
class Tab_InstantActionMain extends GUITabPanel;

#exec OBJ LOAD FILE=RuntimeInterfaceContent.utx

var GUIImage MySDemo;
var GUIImage MySBorder;
var GUIImage MySBorder2;
var GUILabel MyGUILabel;
var GUIButton LoadMapButton;
const DIFFICULTY_NUM = 5;
var localized string MySkills[DIFFICULTY_NUM];
var moComboBox Difficulty;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{

	Super.Initcomponent(MyController, MyOwner);

	MySDemo = GUIImage(Controls[1]);
             MyGUILabel = GUILabel(Controls[2]);
             Difficulty = moComboBox(Controls[3]);
	LoadMapButton = GUIButton(Controls[4]);
	MySBorder = GUIImage(Controls[5]);
	MySBorder2 = GUIImage(Controls[6]);

	//Is this OK?
             Difficulty.AddItem(MySkills[0]);
	Difficulty.AddItem(MySkills[1]);
	Difficulty.AddItem(MySkills[2]);
	Difficulty.AddItem(MySkills[3]);
             Difficulty.ReadOnly(True);
             Difficulty.SetIndex(1);


	Controls[0].SetFocus(none);
}

// Play is called when the play button is pressed.  It saves any releavent data and then
// returns any additions to the URL
function string Play()
{
	SaveConfig();

	return "";
}

function bool LoadMap(GUIComponent Sender)
{

	local string t;
	local int skilll;

        MainMenu(Controller.ActivePage).pPlayer.InternalApply(none);
        
        t = Difficulty.GetText();
	if( t ==  "Easy")
	        skilll=0;
	else if( t ==  "Medium")
	        skilll=1;
	else if( t ==  "Hard")
	        skilll=2;
	else
	        skilll=3;

	Console(Controller.Master.Console).ConsoleCommand("start EM_Runtime?Difficulty="$skilll);  // Was buffered.  Is not now.
	Controller.CloseAll(false);
	return true;
}


defaultproperties
{

	MySkills(0)="Easy"
	MySkills(1)="Medium"
	MySkills(2)="Hard"
	MySkills(3)="Unreal"

	Begin Object class=GUIImage Name=IAMain_MyBorder2
		WinWidth=0.443750
		WinHeight=0.463633
		WinLeft=0.531796
		WinTop=0.163489
		Image=Material'GUIContent.BorderBoxD'
		ImageColor=(R=255,G=255,B=255,A=160);
		ImageRenderStyle=MSTY_Alpha
		ImageStyle=ISTY_Stretched
	End Object
	Controls(6)=GUIImage'IAMain_MyBorder2'

	Begin Object Class=GUIImage Name=IAMain_DemoImage
		WinWidth=0.422750
		WinHeight=0.445633
		WinLeft=0.541796
		WinTop=0.172489
		Image=Material'SPGUIContent.small'
		ImageColor=(R=255,G=255,B=255,A=255);
		ImageStyle=ISTY_Scaled
		ImageRenderStyle=MSTY_Normal
	End Object
	Controls(1)=GUIImage'IAMain_DemoImage'
	
	Begin Object class=GUIImage Name=IAMain_MyBorder
		WinWidth=0.478984
		WinHeight=0.463633
		WinLeft=0.021641
		WinTop=0.161406
		Image=Material'GUIContent.BorderBoxD'
		ImageColor=(R=255,G=255,B=255,A=160);
		ImageRenderStyle=MSTY_Alpha
		ImageStyle=ISTY_Stretched
	End Object
	Controls(5)=GUIImage'IAMain_MyBorder'

	Begin Object class=GUILabel Name=IAMain_Caption
		Caption="blablabla, test"
		TextALign=TXTA_Left
  	        TextFont="MenuFont"
	        bTransparent=true
	        bMultiLine=true
		TextColor=(R=255,G=255,B=255,A=255)
		WinWidth=0.468984
		WinHeight=0.443633
		WinLeft=0.030641
		WinTop=0.171406
		RenderWeight=0.5
	End Object
	Controls(2)=GUILabel'IAMain_Caption'

//no value in combobox.
	Begin Object class=moComboBox Name=IAMain_Difficulty
		WinLeft=0.561796
		WinTop=0.66
		WinWidth=0.35
		WinHeight=0.060000
		CaptionWidth=0.375000
		Caption="Skill Level: "
		Hint="Select the difficulty you wish to play at."
		ComponentJustification=TXTA_Left
	End Object
	Controls(3)=moComboBox'IAMain_Difficulty'

	Begin Object class=GUIButton Name=LoadMapB
		Caption="Start Game"
		Hint="Start new game"
		WinLeft=0.021641
		WinTop=0.66
		WinWidth=0.15
		WinHeight=0.060000
		OnClick=LoadMap
	End Object
	Controls(4)=GUIButton'LoadMapB'
	
	WinTop=0.15
	WinLeft=0
	WinWidth=1
	WinHeight=0.77
	bAcceptsInput=false

}