Jump to content
Sign in to follow this  
sudslv

Help with GUI

Recommended Posts

Hi i'm editing 404Games Wasteland map. and i would like to change 1 thing:

When dropping money i would like the player be able to write the amount of money he wants to drop instead of selecting from list.

I believe this would consist of:

1. changing/deleting the "list" part in GUI.

2. Adding the writable box (write when click on it).

3. limiting only to number keys and adding "$" at end of it(auto).

4. OnButtonClick(drop money) check if player has enough money(already implemented in list version).

5. taking off the value of player and setting it to the money pile. (already implemented in list version).

Yet i only have added buttons to the GUI so i'm fairly new to it. If anyone could guide me through it, it would be nice.

Ask if you need any parts of script.

Thank you for reading.

Share this post


Link to post
Share on other sites

http://forums.bistudio.com/showthread.php?115250-User-Interface-Editor&highlight=GUI+editor

there is an example here that u can download and see and modify to suit your needs.

just to give you a little idea of how the demo does it.

you basically can type in anything you want and when you press ok it shows a hint of what you just typed.

this is part of whats in the description file for that

class MyEditbox: RscEdit
	{
		idc = 1234;

		x = 0.328125 * safezoneW + safezoneX;
		y = 0.425 * safezoneH + safezoneY;
		w = 0.34375 * safezoneW;
		h = 0.15 * safezoneH;
	};
	class MyButtonOK: RscShortcutButton
	{
		onButtonClick = "hint ctrltext ((ctrlParent (_this select 0)) displayCtrl 1234);";

		idc = 1700;
		text = "Ok";
		x = 0.53125 * safezoneW + safezoneX;
		y = 0.575 * safezoneH + safezoneY;
		w = 0.140625 * safezoneW;
		h = 0.1 * safezoneH;
	};

Share this post


Link to post
Share on other sites

Thank you, but i'm not sure if this will help me in this situation. It is ingame tool to create GUI's. However its very late for me so i will go to bed now, i will take harder look at scripts tomorrow.

Share this post


Link to post
Share on other sites

uhhhhh, ok.. :)

that's what the title of your thread is "help with GUI"..

Share this post


Link to post
Share on other sites

This seems to be a rather difficult topic to discuss in here, not everybody has the insight of every mod for ArmA2, and if your mod has been modded by some other site/group, the first thing you should do is head over there :)

Please keep in mind that the name of this subforum is: ARMA 2 & OA : MISSIONS - Editing & Scripting.

I'm sure the people there can help you in a more direct manner than here.

http://www.404games.co.uk/forum/index.php?/forum/73-404games-wasteland/

Share this post


Link to post
Share on other sites
I'm sure the people there can help you in a more direct manner than here.

Maybye, but i think i didn't point out what i want to do (my bad).

So can anyone say how to:

1. enable the RscEdit part when player CLICKS on it.

2. Limit players to only use only NUMBERS "0-9".

Share this post


Link to post
Share on other sites

Point1: A disabled control cannot be clicked on, so setting "onMouseButtonClick"-events wont work, meaning you can't enable a control when you click at it.

Maybe an onMouseEnter or onFocus could help?

Hmm point 2. is tricky, afaik there is no operator to check if a string only contains numbers.

I'd do it like this: add an keyUp-eventhandler to the Edit-field and check the last inputted char.

if (isNil "numericDIKCodes") then
{
   numericDIKCodes = [];
   for "_number" from 0 to 9 do {
       call compile format["numericDIKCodes set [count numericDIKCodes, DIK_%1]; numericDIKCodes set [count numericDIKCodes, DIK_NUMPAD%1];", _number];
   };
};

_myControl ctrlSetEventHandler ["KeyUp", "if (! ((_this select 1) in numericDIKCodes)) exitWith {false;}; true;"];

I don't know if this would stop the input but it's worth a shot.

If this doesn't work you have to use toArray to split the whole text in the input-field into each letter and cycle through that array to detect a non-numeric char, delete it out of the array and writing the result back into the input-field with toString.

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
Sign in to follow this  

×