Home   Help Search Login Register  

Author Topic: SPON money troubles!!  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

Offline danturn

  • Members
  • *
SPON money troubles!!
« 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

Offline ModestNovice

  • Members
  • *
Re: SPON money troubles!!
« Reply #1 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"]

]
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON money troubles!!
« Reply #2 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.
« Last Edit: 29 Oct 2008, 02:12:22 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline ModestNovice

  • Members
  • *
Re: SPON money troubles!!
« Reply #3 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 ;)
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline danturn

  • Members
  • *
Re: SPON money troubles!!
« Reply #4 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

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON money troubles!!
« Reply #5 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 ;( ).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline danturn

  • Members
  • *
Re: SPON money troubles!!
« Reply #6 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

Offline ModestNovice

  • Members
  • *
Re: SPON money troubles!!
« Reply #7 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 \\
« Last Edit: 29 Oct 2008, 01:29:16 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline danturn

  • Members
  • *
Re: SPON money troubles!!
« Reply #8 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?

Offline ModestNovice

  • Members
  • *
Re: SPON money troubles!!
« Reply #9 on: 29 Oct 2008, 01:43:20 »
you need commas between the gun and the price:
Code: [Select]
[
[
["m16a2", 200]
],

[
["30Rnd_556x45_Stanag", 25]
]
];
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline danturn

  • Members
  • *
Re: SPON money troubles!!
« Reply #10 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";

Offline ModestNovice

  • Members
  • *
Re: SPON money troubles!!
« Reply #11 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.


« Last Edit: 29 Oct 2008, 02:03:03 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON money troubles!!
« Reply #12 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).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline danturn

  • Members
  • *
Re: SPON money troubles!!
« Reply #13 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

« Last Edit: 29 Oct 2008, 02:40:46 by danturn »

Offline ModestNovice

  • Members
  • *
Re: SPON money troubles!!
« Reply #14 on: 29 Oct 2008, 03:02:39 »
EDIT (Spooner): moved post to it's own new thread since it changed the topic significantly.
« Last Edit: 29 Oct 2008, 03:54:20 by Spooner »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley