Jump to content


Iron_M

Member Since 29 Dec 2007
Offline Last Active Aug 04 2011 02:03 AM

Posts I've Made

In Topic: Without Using Execute_string()

15 November 2009 - 11:18 PM

put all your data in 1 array
put all your data in 1 data structure (ds_list)
put all your arrays in another array.
i'm not sure what your trying to accomplish.

for(k=1;k<=3;k+=1)
	{
	for(i=1;i<=data_width;i+=1)
		{
		for(ii=1;ii<=data_height;ii+=1)
			{
			if data_all[k,data[i,ii]]== data_needed
				{
				scr_data(k,i,ii);
				}
			}
		}
	}


Can't make it work like you have it cause different data groups have different widths, heights, and names. But I think if I could somehow store the all the different arrays inside another array, I could make it work something like that.

I could possibly put all the data in one structure, but that would be inefficient because not all data types need to be accessed at once, just sometimes. And I would need to add a flag, and a check for what kind of data is being read since it would be all bunched together.

Thanks for the ideas everyone.

[EDIT]

Okay, I was able to get it to work using the following:
type = "data1"
type_width = data1_width
type_height = data1_height
data_needed = data1_needed
for(j=1;j<=3;j+=1)
	{
	for(i=1;i<=type_width;i+=1)
		{
		for(ii=1;ii<=type_height;ii+=1)
			{
			if variable_local_array2_get(type,i,ii) == data_needed
				{
				scr_data(type,i,ii);
				}
			}
		}
	switch j
		{
		case 1:
			{
			type = "data2"
			type_width = data2_width
			type_height = data2_height
			data_needed = data2_needed
			break;
			}
		case 2:
			{
			type = "data3"
			type_width = data3_width
			type_height = data3_height
			data_needed = data3_needed
			break;
			}
		}
	}

I realize that I've pretty much circumvented any "easy" solution, but it's still worth it seeing as my actual code is much bigger. If anyone knows a more optimized way of accomplishing the same thing, I'd love to hear it. (This would all be much easier with a 3d array.) :)

In Topic: Without Using Execute_string()

15 November 2009 - 10:26 PM

variable_local_array2_get("data1", i, ii);

The above will allow you to retrieve data from an array based on a string.


Thanks, I'm not familiar with that function, but I will give it a try.

It's a shame GM doesn't support 3 dimensional arrays, because you could do something like this:


There have been a few times I could have made use of 3d arrays. Thanks

In Topic: Question About Views

31 October 2009 - 04:48 AM

Thanks for the speedy help both of you. :(

In Topic: Question About Views

31 October 2009 - 04:47 AM

Wow, I never knew that!

So when you call a view_hview without the array part on the end it just defaults to view_hview[0]?

In Topic: My Game Object Fails To Follow The Mouse /

28 October 2009 - 08:14 AM

Objects will always lag somewhat behind the mouse. If you turn off the cursor, at least players won't be able to compare the place of the object relative to the actual mouse position.

Also, to reduce the noticeability of lag, try manually drawing your object at the desired location each step.

Here is a topic you may find useful http://gmc.yoyogames...opic=380904&hl=