Game Development Community

Some Questions on Working with Vectors

by Chris "Hyena" Vogel · in Torque Game Builder · 09/02/2005 (11:44 pm) · 2 replies

I'm having trouble finding functions to work with vectors...

I have a vector of id's containing what was just picked by my character. it could be 2, 3, or 10 items long. one example might be
%picked = "1236 1016 1250 1262"

How can I take this %picked variable and do something to each ID that was picked? What function can I use to determine how many items are in that vector? Is there a vector.getcount() type of function?

#1
09/03/2005 (1:50 am)
Yes, there's getWordCount(%vector) and getWord(%vector, %index), so you do something like:

if (getWordCount(%picked) > 0) {
	for (%i = 0; %i < getWordCount(%picked); %i++) {
		echo(getWord(%picked, %i));
	}
}

--
Hans
#2
09/03/2005 (8:49 am)
Thanks Hans! It was the GetWordCount() function that I was missing =)