Brian Posted May 4, 2012 Posted May 4, 2012 add setdarray getdarray I think getelementofarray can be used to do some of this. For example: set .@group, 1; // for each element in .items_1[] for (set .@i,0; .@i<10; set .@i, .@i+1) { set .@this_item, getelementofarray(getd(".items_"+.@group), .@i); // do stuff with .@this_item }
Senshuken Posted May 5, 2012 Author Posted May 5, 2012 add setdarray getdarray I think getelementofarray can be used to do some of this. For example: set .@group, 1; // for each element in .items_1[] for (set .@i,0; .@i<10; set .@i, .@i+1) { set .@this_item, getelementofarray(getd(".items_"+.@group), .@i); // do stuff with .@this_item } Sorry, I meant it as a dynamic array setter and getter.
saithis Posted May 5, 2012 Posted May 5, 2012 This does already work with setd and getd: getd(".somearray["+.@i+"]"); setd ".somearray["+.@i+"]", 0; or did you mean something like that: setdarray ".somearray", 0, 5, 4, 3, 6; but here getdarray would make no sense, since you can only get 1 value at a time 1
Senshuken Posted May 5, 2012 Author Posted May 5, 2012 This does already work with setd and getd: getd(".somearray["+.@i+"]"); setd ".somearray["+.@i+"]", 0; or did you mean something like that: setdarray ".somearray", 0, 5, 4, 3, 6; but here getdarray would make no sense, since you can only get 1 value at a time You're right, getdarray would be pointless, but yes I do mean the setdarray ".somearray", 0, 1, 2, 3, 4
ToastOfDoom Posted November 24, 2012 Posted November 24, 2012 you can already do this using a combination of getd and setarray. setarray getd(".test[0]"), 1, 2, 3, 4, 5; Also sorry for the necro... =P 1
Euphy Posted November 24, 2012 Posted November 24, 2012 Added the array example to script_commands.txt in r16963 since it could be helpful. :>
Recommended Posts