ok, here's the quadary:
I've made it so that I have a seriese of int's corresponding to objects on screen.
I'm using these int's to define (amongst other things) what graphic that object should appear as e.g:
if (int1 == 5)
object5 image = view 6, loop 1, frame 0
What I'd like to be able to do would be to write a function along the lines of
function intgraphic(X,Z) //where X is an int (e.g. int1) and Z is an object (e.g. object5)
{
if(X = 1)
{
Z.set_frame = view 6, loop 1, frame 0
}
else if(X = 2)
{
Z.set_frame = view 6, loop 1, frame 2
}
etc etc
}
is this possible i.e. is it possible to pass an object into a function? And if you CAN pass an object to a function, what do you write in the header file instead of
import function intgraphic(int,I_DON'T_KNOW_WHAT_GOES_HERE)
To operate an object you use it's ID, right? Therefore it is that number you have to pass into the function. It's usual int btw.
in header:
import function intgraphic(int, int);
-Cheers
so you're saying that the function would look something like this:
function change-graphic-according-to-integer-value(X,Y)
{
if(X == 1)
{
object(Y).frame(view loop and frame)
}
?
Or is there something I missed?
(thanks for all this helping by the way... I don't know what I'd do without it... Probably not make many games I suppose)
OK, I've got that bit so it doesn't have any errors, but now I've got to the testing point and BAH!!!
When I use the "use inventory on hotspot" interaction option, I don't lose the inventory item (I've not got the "don't automatically lose inventory item" checkbox ticked so it's not that!)
Do I have to type out "lose inventory- blah de blah" for all interactions these days?
ALSO, are arrays numbered in the same way as they are in C++
i.e.
does an array of length 3 go from 0-2 or 1-3?
More questions on the way, when I can work out why it's not working...
Quoteso you're saying that the function would look something like this...
aha, that is it.
QuoteWhen I use the "use inventory on hotspot" interaction option, I don't lose the inventory item (I've not got the "don't automatically lose inventory item" checkbox ticked so it's not that!)
Do I have to type out "lose inventory- blah de blah" for all interactions these days?
There is another possible cause. When you add an item to the inventory AGS doing something like:
character[id].inv[ x ]++;
so it just increases the value
when you lose inventory item it process:
character[id].inv[ x ]--;
instead of character[].inv[ x ] = 0;
Although the way AGS do it is logical there is maybe the source of a problem.
so maybe the player has more than one item actually therefore he loses only one.
Place the line
Display("items: %d", character[id].inv[ x ]); to figure out how many exemplars of a certain item the player has really.
QuoteALSO, are arrays numbered in the same way as they are in C++
i.e.
does an array of length 3 go from 0-2 or 1-3?
yes, like in C, the indexation is zero-based therefore the statement:
int vector[3];
declares an array
vector with the size of 3 elements. The first element has index number 0 and the last has index number 2.
-Cheers