Jump to content
Sign in to follow this  
T. Miller

lnbAddRow variable usage

Recommended Posts

Hello everyone,

I am creating a store-dialog. Using a 'listnbox' I list all the things that are up for sale.

The layout of the store is - as seen in this picture - the following:

<weapon> <price> <amount>

The way I am creating this is using the command lnbAddRow.

MILstore_setContent.sqf

while {dialogStatus == 0;} do
{
if (CategoryIndex == 0) then
{
	lnbClear 1500;

	lnbAddRow [1500,["P07 9 mm","$600","0"]];
	lnbAddRow [1500,["4-five .45","$900","0"]];
	lnbAddRow [1500,["Vermin SMG .45 ACP","$1200","0"]];
	lnbAddRow [1500,["SDAR 5.56 mm","$1400","0"]];
	lnbAddRow [1500,["MXC 6.5 mm","$1400","0"]];
	lnbAddRow [1500,["MXC 6.5 mm (Black)","$1400","0"]];
	lnbAddRow [1500,["MX 6.5 mm","$1700","0"]];
	lnbAddRow [1500,["MX 6.5 mm (Black)","$1700","0"]];
	lnbAddRow [1500,["MX 3GL 6.5 mm","$2100","0"]];
	lnbAddRow [1500,["MX 3GL 6.5 mm (Black)","$2100","0"]];
	lnbAddRow [1500,["MX SW 6.5 mm","$1900","0"]];
	lnbAddRow [1500,["MX SW 6.5 mm (Black)","$1900","0"]];
	lnbAddRow [1500,["MXM 6.5 mm","$1800","0"]];
	lnbAddRow [1500,["MXM 6.5 mm (Black)","$1800","0"]];
	lnbAddRow [1500,["Mk-I EMR 7.62mm (Black)","$2600","0"]];
	lnbAddRow [1500,["Mk-I EMR 7.62mm (Khaki)","$2600","0"]];
	lnbAddRow [1500,["Mk-I EMR 7.62mm (Sand)","$2600","0"]];
	lnbAddRow [1500,["Mk-I EMR 7.62mm (Camo)","$2600","0"]];
	lnbAddRow [1500,["Mk-I EMR 7.62mm (Woodland)","$2600","0"]];
	lnbAddRow [1500,["MAR-10 .338 (Black)","$3150","0"]];
	lnbAddRow [1500,["MAR-10 .338 (Camo)","$3150","0"]];
	lnbAddRow [1500,["MAR-10 .338 (Sand)","$3150","0"]];
	lnbAddRow [1500,["SPMG .338 (MTP)","$4600","0"]];
	lnbAddRow [1500,["SPMG .338 (Black)","$4600","0"]];
	lnbAddRow [1500,["SPMG .338 (Sand)","$4600","0"]];
	lnbAddRow [1500,["PCML","$2800","0"]];
	lnbAddRow [1500,["Titan MPRL Compact","$3100","0"]];
	lnbAddRow [1500,["Titan MPRL Launcher","$3100","0"]];

	waitUntil {CategoryIndex != 0;};
};

if (CategoryIndex == 1) then
{
	lnbClear 1500;

	lnbAddRow [1500,["9mm 16Rnd Mag","$2100","0"]];
	lnbAddRow [1500,["9mm 30Rnd Mag","$2100","0"]];
	lnbAddRow [1500,[".45 ACP 11Rnd Mag","$4600","0"]];
	lnbAddRow [1500,[".45 ACP 30Rnd Vermin Mag","$4600","0"]];
	lnbAddRow [1500,["5.56mm 30rnd STANAG Mag","$2800","0"]];
	lnbAddRow [1500,["5.56mm 30rnd Tracer (Red) Mag","$3100","0"]];
	lnbAddRow [1500,["5.56mm 20Rnd Dual Purpose Mag","$3100","0"]];
	lnbAddRow [1500,["6.5mm 30Rnd STANAG Mag","$600","0"]];
	lnbAddRow [1500,["6.5mm 30Rnd Tracer (Red) Mag","$900","0"]];
	lnbAddRow [1500,["6.5mm 100Rnd Belt Case","$1700","0"]];
	lnbAddRow [1500,["6.5mm 100Rnd Tracer (Red) Belt Case","$1700","0"]];
	lnbAddRow [1500,["7.62mm 20Rnd Mag","$1400","0"]];
	lnbAddRow [1500,[".338 LM 10Rnd Mag","$4600","0"]];
	lnbAddRow [1500,[".338 NM 130Rnd Belt","$4600","0"]];
	lnbAddRow [1500,[".408 7Rnd LRR Mag","$1400","0"]];
	lnbAddRow [1500,["PCML Missile","$1900","0"]];
	lnbAddRow [1500,["Titan AP Missile","$4600","0"]];
	lnbAddRow [1500,["Titan AT Missile","$4600","0"]];
	lnbAddRow [1500,["Titan AA Missile","$4600","0"]];
	lnbAddRow [1500,["40mm HE Grenade Round","$1900","0"]];
	lnbAddRow [1500,["Smoke Round (White)","$1800","0"]];
	lnbAddRow [1500,["Smoke Round (Red)","$3150","0"]];
	lnbAddRow [1500,["Smoke Round (Green)","$3150","0"]];
	lnbAddRow [1500,["Smoke Round (Yellow)","$2600","0"]];
	lnbAddRow [1500,["Smoke Round (Purple)","$2600","0"]];
	lnbAddRow [1500,["Smoke Round (Blue)","$4600","0"]];
	lnbAddRow [1500,["Smoke Round (Orange)","$4600","0"]];
	lnbAddRow [1500,["Flare Round (White)","$4600","0"]];
	lnbAddRow [1500,["Flare Round (Green)","$4600","0"]];
	lnbAddRow [1500,["Flare Round (Red)","$4600","0"]];
	lnbAddRow [1500,["Flare Round (Yellow)","$4600","0"]];
	lnbAddRow [1500,["Flare Round (IR)","$4600","0"]];
	lnbAddRow [1500,["40mm 3Rnd HE Grenade","$1800","0"]];
	lnbAddRow [1500,["3Rnd 3GL Smoke Rounds (White)","$1200","0"]];
	lnbAddRow [1500,["3Rnd 3GL Smoke Rounds (Red)","$3150","0"]];
	lnbAddRow [1500,["3Rnd 3GL Smoke Rounds (Green)","$2600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Smoke Rounds (Yellow)","$2600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Smoke Rounds (Purple)","$2600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Smoke Rounds (Blue)","$4600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Smoke Rounds (Orange)","$4600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Flares (White)","$4600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Flares (Green)","$4600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Flares (Red)","$4600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Flares (Yellow)","$4600","0"]];
	lnbAddRow [1500,["3Rnd 3GL Flares (IR)","$4600","0"]];
	lnbAddRow [1500,["RGO Grenade","$4600","0"]];
	lnbAddRow [1500,["RGN Grenade","$4600","0"]];
	lnbAddRow [1500,["Smoke Grenade (White)","$4600","0"]];
	lnbAddRow [1500,["Smoke Grenade (Red)","$4600","0"]];
	lnbAddRow [1500,["Smoke Grenade (Green)","$4600","0"]];
	lnbAddRow [1500,["Smoke Grenade (Yellow)","$4600","0"]];
	lnbAddRow [1500,["Smoke Grenade (Purple)","$4600","0"]];
	lnbAddRow [1500,["Smoke Grenade (Blue)","$4600","0"]];
	lnbAddRow [1500,["Smoke Grenade (Orange)","$4600","0"]];
	lnbAddRow [1500,["Chemlight (Green)","$4600","0"]];
	lnbAddRow [1500,["IR Grenade [NATO]","$4600","0"]];
	lnbAddRow [1500,["Designator Batteries","$4600","0"]];
	lnbAddRow [1500,["APERS Mine","$4600","0"]];
	lnbAddRow [1500,["APERS Bounding Mine","$4600","0"]];
	lnbAddRow [1500,["AT Mine","$4600","0"]];
	lnbAddRow [1500,["Explosive Charge","$4600","0"]];
	lnbAddRow [1500,["Explosive Satchel","$4600","0"]];

	waitUntil {CategoryIndex != 1;};
};
};

MILstore_onPlus.sqf

_index = lbCurSel 1500;     //to find the selected option in the listnbox

_amount = ((findDisplay 1) displayCtrl 1500) lnbText [_index,2];     //to find the third row, the "0" that I put in using lnbAddRow, figured that I need that to be able to change it, eventhough it is not a variable.

How do I make the <amount> a variable which I can change using other scripts?

I tried using ["%1", PD7_count] instead of "0", but it didn't work out.

Any help/example on how to make this number/text a variable, changeable using my + and - buttons?

Thanks in advance.

Edited by dyzalonius

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  

×