Jump to content
Sign in to follow this  
eagledude4

RscButton action not executing fucntion

Recommended Posts

ATM.hpp

class atmmenu {
idd = -1;
movingEnable = true;
controlsBackground[] = {DLG_BACK, background};
objects[] = { };
controls[] = {deposit, withdraw, cancel, dummybutton};

class DLG_BACK: RscBackground {
	x = 0.40;
	y = 0.25;
	w = 0.22;
	h = 0.19;
};

class background : RscBgRahmen {
	x = 0.40;
	y = 0.25;
	w = 0.22;
	h = 0.19;
	text = "Choose an Option";
};

class deposit : RscButton {
	idc = 11;
	x = 0.41;
	y = 0.28;
	w = 0.20;
	h = 0.03;
	text = "Deposit";
	action = "closedialog 0; createDialog ""atmmenu_deposit""";
};

class withdraw : RscButton {
	idc = 12;
	x = 0.41;
	y = 0.33;
	w = 0.20;
	h = 0.03;
	text = "Withdraw";
	action = "closedialog 0; createDialog ""atmmenu_withdraw""";
};

class cancel : RscButton {
	x = 0.41;
	y = 0.38;
	w = 0.20;
	h = 0.04;
	text = "Cancel";
	action = "closedialog 0";
};

class dummybutton : RscDummy {idc = 1006;};
};

class atmmenu_deposit {
idd = -1;
movingEnable = true;
controlsBackground[] = {DLG_BACK, background};
objects[] = { };
controls[] = {5, 10, 20, 50, 100, 200, cancel, dummybutton};

class DLG_BACK: RscBackground {
	x = 0.40;
	y = 0.25;
	w = 0.22;
	h = 0.39;
};

class background : RscBgRahmen {
	x = 0.40;
	y = 0.25;
	w = 0.22;
	h = 0.39;
	text = "Choose an Amount";
};

class 5 : RscButton {
	idc = 11;
	x = 0.41;
	y = 0.28;
	w = 0.20;
	h = 0.03;
	text = "$5";
	action = "[""Deposit"", 5] call ED4_fnc_ATM; closedialog 0";
};

class 10 : RscButton {
	idc = 12;
	x = 0.41;
	y = 0.33;
	w = 0.20;
	h = 0.03;
	text = "$10";
	action = "[""Deposit"", 10] call ED4_fnc_ATM; closedialog 0";
};

class 20 : RscButton {
	x = 0.41;
	y = 0.38;
	w = 0.20;
	h = 0.03;
	text = "$20";
	action = "[""Deposit"", 20] call ED4_fnc_ATM; closedialog 0";
};

class 50 : RscButton {
	x = 0.41;
	y = 0.43;
	w = 0.20;
	h = 0.03;
	text = "$50";
	action = "[""Deposit"", 50] call ED4_fnc_ATM; closedialog 0";
};

class 100 : RscButton {
	x = 0.41;
	y = 0.48;
	w = 0.20;
	h = 0.03;
	text = "$100";
	action = "[""Deposit"", 100] call ED4_fnc_ATM; closedialog 0";
};

class 200 : RscButton {
	x = 0.41;
	y = 0.53;
	w = 0.20;
	h = 0.03;
	text = "$200";
	action = "[""Deposit"", 200] call ED4_fnc_ATM; closedialog 0";
};

class cancel : RscButton {
	x = 0.41;
	y = 0.58;
	w = 0.20;
	h = 0.04;
	text = "Cancel";
	action = "closedialog 0";
};

class dummybutton : RscDummy {idc = 1006;};
};

class atmmenu_withdraw {
idd = -1;
movingEnable = true;
controlsBackground[] = {DLG_BACK, background};
objects[] = { };
controls[] = {5, 10, 20, 50, 100, 200, cancel, dummybutton};

class DLG_BACK: RscBackground {
	x = 0.40;
	y = 0.25;
	w = 0.22;
	h = 0.39;
};

class background : RscBgRahmen {
	x = 0.40;
	y = 0.25;
	w = 0.22;
	h = 0.39;
	text = "Choose an Amount";
};

class 5 : RscButton {
	idc = 11;
	x = 0.41;
	y = 0.28;
	w = 0.20;
	h = 0.03;
	text = "$5";
	action = "[""Withdraw"", 5] call ED4_fnc_ATM; closedialog 0";
};

class 10 : RscButton {
	idc = 12;
	x = 0.41;
	y = 0.33;
	w = 0.20;
	h = 0.03;
	text = "$10";
	action = "[""Withdraw"", 10] call ED4_fnc_ATM; closedialog 0";
};

class 20 : RscButton {
	x = 0.41;
	y = 0.38;
	w = 0.20;
	h = 0.03;
	text = "$20";
	action = "[""Withdraw"", 20] call ED4_fnc_ATM; closedialog 0";
};

class 50 : RscButton {
	x = 0.41;
	y = 0.43;
	w = 0.20;
	h = 0.03;
	text = "$50";
	action = "[""Withdraw"", 50] call ED4_fnc_ATM; closedialog 0";
};

class 100 : RscButton {
	x = 0.41;
	y = 0.48;
	w = 0.20;
	h = 0.03;
	text = "$100";
	action = "[""Withdraw"", 100] call ED4_fnc_ATM; closedialog 0";
};

class 200 : RscButton {
	x = 0.41;
	y = 0.53;
	w = 0.20;
	h = 0.03;
	text = "$200";
	action = "[""Withdraw"", 200] call ED4_fnc_ATM; closedialog 0";
};

class cancel : RscButton {
	x = 0.41;
	y = 0.58;
	w = 0.20;
	h = 0.04;
	text = "Cancel";
	action = "closedialog 0";
};

class dummybutton : RscDummy {idc = 1006;};
};

none of the buttons that call ED4_fnc_ATM seem to actually call the function, but they do close the dialog.

fn_ATM:

//By Eagledude4

_type = _this select 0;
_amount = _this select 1;

systemChat "TEST";

switch _type do {
case "Deposit": {
	if (("money" call INV_getItemAmount) < _amount) exitwith {
		systemChat "Insufficient Funds";
	};

	Bankbalance = Bankbalance + _amount;
	systemChat format ["$%1 Sucessfully Deposited", _amount];
case "Withdraw": {
	if (Bankbalance < _amount) exitwith {
		systemChat "Insufficient Funds";
	};

	['money', _amount] call INV_AddInvItem;
	systemChat format ["$%1 Sucessfully Withdrawn", _amount];
};
};

The systemChat "TEST" doesn't execute, and there are no errors in my rpt.

Share this post


Link to post
Share on other sites

Missing "}"

use this

_type = _this select 0;
_amount = _this select 1;

systemChat "TEST";

switch (ToUpper _type) do 
{
case "DEPOSIT": 
{
	if (("money" call INV_getItemAmount) < _amount) exitwith 
	{
		systemChat "Insufficient Funds";
	};
	Bankbalance = Bankbalance + _amount;
	systemChat format ["$%1 Sucessfully Deposited", _amount];
};
case "WITHDRAW": 
{
	if (Bankbalance < _amount) exitwith 
	{
		systemChat "Insufficient Funds";
	};

	['money', _amount] call INV_AddInvItem;
	systemChat format ["$%1 Sucessfully Withdrawn", _amount];
};

Default {Systemchat format ["ERROR: %1 << Scriptname here >> not seen as an option",_type]};
};

Edited by Terox

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  

×