OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: danturn on 28 Oct 2008, 20:42:05

Title: SPON money troubles!!
Post by: danturn on 28 Oct 2008, 20:42:05
Ok, the first problem appears to be with the init.sqf file, it is saying im missing a "]" from line 22, but i can't seem to find where.

Code: [Select]
[["prices.sqf"]] call compile preprocessFileLineNumbers "SPON\Money\initMoney.sqf";

[
["prices.sqf"],
"$",
{ 50 },
{ if (playerside == WEST) then { 250 } else { 150 }; },
0.5
] execVM "SPON\money\initmoney.sqf";

//----------------------------------------------------------------------------------
//shopkeepers

_gunshop =
[
//gunshopweapons.
["m16A2"],

//gunshopmagazines.
["30Rnd_556x45_Stanag"],

]

[gunshopowner, 0.25, 1.0, _gunshop] execVM "SPON\Money\setshop.sqf";

//----------------------------------------------------------------------------------
//bankers

[banker1] execVM "SPON\Money\setbank.sqf";

nil; // Return.

Is what I have.

Also, when the browse shop thing does appear (i fiddled about with brackets, and i still go an error about missing brackets but the browse shop action appeared), It fails to activate as it can't find dlg.money or something along those lines, any ideas what is missing?

Thanks
Title: Re: SPON money troubles!!
Post by: ModestNovice on 29 Oct 2008, 00:01:40
your missing a "]", becuz you have unwanted commas in your arrays.

At the end of an array there is no need for a comma.

your init.sqf should look like this:

Code: [Select]
[["prices.sqf"]] call compile preprocessFileLineNumbers "SPON\Money\initMoney.sqf";

[
["prices.sqf"],
"$",
{ 50 },
{ if (playerside == WEST) then { 250 } else { 150 }; },
0.5
] execVM "SPON\money\initmoney.sqf";

//----------------------------------------------------------------------------------
//shopkeepers

_gunshop =
[
//gunshopweapons.
["m16A2"]

//gunshopmagazines.
["30Rnd_556x45_Stanag"]

]

[gunshopowner, 0.25, 1.0, _gunshop] execVM "SPON\Money\setshop.sqf";

//----------------------------------------------------------------------------------
//bankers

[banker1] execVM "SPON\Money\setbank.sqf";

nil; // Return.




====================================================================================

YOU ONLY NEED COMMAS IF YOU HAVE MORE THAN ONE THING IN THE ARRAY!

For Example:
Code: [Select]
_gunshop =
[
//gunshopweapons.
["m16A2"],
       ["m4"]

//gunshopmagazines.
["30Rnd_556x45_Stanag"]

]
Title: Re: SPON money troubles!!
Post by: Spooner on 29 Oct 2008, 00:50:23
Your last example should be:
Code: [Select]
_gunshop =
[
//gunshopweapons.
["m16A2", "m4"],

//gunshopmagazines.
["30Rnd_556x45_Stanag"],

//gunshop vehicles.
[]
];

You need commas after every element except the last one (or, alternatively, you need a single comma between each element). You also need a ; after the last ] in this case.

EDIT: I originally corrected the ArmA syntax, but didn't think to correct it to the format SPON Money requires. Good now.
Title: Re: SPON money troubles!!
Post by: ModestNovice on 29 Oct 2008, 01:07:14
Daaghhh, right Spooner, that is what I meant, I got mixed up and saw the two areas as two arrays  :-[

Thanks ;)
Title: Re: SPON money troubles!!
Post by: danturn on 29 Oct 2008, 01:10:01
Code: [Select]
[["prices.sqf"]] call compile preprocessFileLineNumbers "SPON\Money\initMoney.sqf";

[
["prices.sqf"],
"$",
{ 50 },
{ if (playerside == WEST) then { 250 } else { 150 }; },
0.5
] execVM "SPON\money\initmoney.sqf";

//----------------------------------------------------------------------------------
//shopkeepers

_gunshop =
[
//gunshopweapons.
["m16A2"],

//gunshopmagazines.
["30Rnd_556x45_Stanag"]

];

[gunshopowner, 0.25, 1.0, _gunshop] execVM "SPON\Money\setshop.sqf";

//----------------------------------------------------------------------------------
//bankers

[banker1] execVM "SPON\Money\setbank.sqf";

nil; // Return.

on loading the misson i get an invalid number in expression line 2.
as well as this "browse shop" and "bank" appear on the two appropriate people, however when im using the actions i get a message saying "spon_dlgmoney" not found, followed buy a failed to open hint.

cheers guys
Title: Re: SPON money troubles!!
Post by: Spooner on 29 Oct 2008, 01:18:36
Are you sure that the error message is talking about that particular file? It looks fine to me.

For the SPON_dlgShop error, you need to remember to add the required stuff to your description.ext file (It is entirely possible I said extension.ext, because I always typed that wrong in the early days ;( ).
Title: Re: SPON money troubles!!
Post by: danturn on 29 Oct 2008, 01:24:36
Ahhh noo, its the prices.sqf that its getting it from, havnt really looked over it properly yet, but here is what i have

Code: [Select]
[
[\\gunshopweapons.
["m16a2" 200],

],

[//gunshopmagazines.
["30Rnd_556x45_Stanag" 25],

],
]

just basic for now.

changed extension to description, still getting the error though :oS

cheers
Title: Re: SPON money troubles!!
Post by: ModestNovice on 29 Oct 2008, 01:27:11
Code: [Select]
[
[//gunshopweapons.
["m16a2", 200]
],

[//gunshopmagazines.
["30Rnd_556x45_Stanag", 25]
]
];

also to make sure anything you want to comment out is //your comment here, rather than \\
Title: Re: SPON money troubles!!
Post by: danturn on 29 Oct 2008, 01:36:43
so on my prices i don't actually need the //gunshopowner? i figured this must link it to what is wrote in the init.

so really i could get away with ...?

Code: [Select]
[
["m16a2"                200],
        ["30Rnd_556x45_Stanag" 25],

],
]


?

i suddenly dont get that error anymore lol!

Will a shopowner only buy back an item if it is in his stock list?
Title: Re: SPON money troubles!!
Post by: ModestNovice on 29 Oct 2008, 01:43:20
you need commas between the gun and the price:
Code: [Select]
[
[
["m16a2", 200]
],

[
["30Rnd_556x45_Stanag", 25]
]
];
Title: Re: SPON money troubles!!
Post by: danturn on 29 Oct 2008, 01:50:54
That's excellent. all working fine now. cheers for your help!

One last thing... so far :P

Instead of having every stock list in my init.sqf, to make things more organised, is it possible to have stock1.sqf, stock2.sqf etc as different files and rewrite it like...

Code: [Select]
_gunshop =
[
execVM stock1.sqf
];

[gunshopowner, 0.25, 1.5, _gunshop] execVM "SPON\Money\setshop.sqf";
Title: Re: SPON money troubles!!
Post by: ModestNovice on 29 Oct 2008, 02:01:26
probably not as Spooners system is set up in a certain way.

BUT you could do it like this:

my_stocks.sqf
Code: [Select]
stock1 =
[
["M16A2"],
["M4A1"],

["30Rnd_556x45_Stanag"]
];

stock2 =
[
];

stock3 =
[
];


==============


init.sqf
Code: [Select]
[["prices.sqf"]] call compile preprocessFileLineNumbers "SPON\Money\initMoney.sqf";

[
["prices.sqf"],
"$",
{ 50 },
{ if (playerside == WEST) then { 250 } else { 150 }; },
0.5
] execVM "SPON\money\initmoney.sqf";
[] execVM "my_stocks.sqf";

//----------------------------------------------------------------------------------
//shopkeepers


[gunshopowner, 0.25, 1.0, stock1] execVM "SPON\Money\setshop.sqf";

//----------------------------------------------------------------------------------
//bankers

[banker1] execVM "SPON\Money\setbank.sqf";

nil; // Return.


Title: Re: SPON money troubles!!
Post by: Spooner on 29 Oct 2008, 02:10:35
Yes, you could do that this way:
Code: (in init.sqf) [Select]
_gunshopStock = call compile preprocessFileLineNumbers "gunshopStock.sqf";

[gunshopowner, 0.25, 1.5, _gunshopStock] execVM "SPON\Money\setshop.sqf";

Code: (gunshopStock.sqf) [Select]
[
["M16A2", "M4A1"], // Weapons for sale.

["30Rnd_556x45_Stanag"], // Ammo for sale.

[] // If you want no vehicles, you need to specify none. You can't just leave it out.
];

Shop owners only sell what is on their list, but they will buy anything that is in the global prices file (prices.sqf in this case).
Title: Re: SPON money troubles!!
Post by: danturn on 29 Oct 2008, 02:22:38
Managed to work out what i'd done wrong with what i previously wrote here.

Is there a way to stop you from selling certain items to certain people? for example there is a drug dealer in game and i only want the player to be able to sell drugs to him and no one else

Title: Re: SPON money troubles!!
Post by: ModestNovice on 29 Oct 2008, 03:02:39
EDIT (Spooner): moved post to it's own new thread (http://www.ofpec.com/forum/index.php?topic=32468.0) since it changed the topic significantly.