The Dink Network

Reply to Re: Data type hacks...

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
August 15th 2024, 12:07 PM
death.gif
Seseler
Peasant He/Him Heard Island And Mcdonald Islands
 
I meant that you can use editor_seq with the sprite number as array index and sequence as value, so you can do something like this

//Switch to screen holding the array
int &old_map = &player_map;
&player_map = 123;
//Store 10 numbers to an array
int &index = 1;
int &value = 1;
loop:
&value *= 2;
editor_seq(&index, &value);

&index += 1;
if(&index < 11)
{
    goto loop;
}

&player_map = &old_map;
//Now we effectively have an array of [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]



You can retrieve values by editor_seq(&index, -1), like this:

freeze(1);
int &old_map = &player_map;
&player_map = 123;
int &index = 1;
int &value;

loop:
&value = editor_seq(&index, -1);
say_stop("The value at index &index is &value", 1);
&index += 1;
if(&index < 11)
{
	goto loop;
}

&player_map = &old_map;
unfreeze(1);



edit: fixed the &value increment

edit2: forgot that editor sprite numbers start from 1

edit3: added the value readback script