The Dink Network

Reply to Re: Bah

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:
 
 
January 22nd 2014, 05:27 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Short answer: Nope. That limit is built into the engine.
Long answer: Oh, boy.

Do you have any unused screens? Write down their map number. Create an empty screen on one, and make it obvious that nobody should ever be there in-game.

Now what? Now you can make use of the editor_seq and editor_frame of the editor sprites on that screen! "But wait," you say "there are no sprites!". No worries. The engine doesn't really care, as far as I know.

Anyway, you basically just got 99 extra 8-bit unsigned variables (the editor_frames), and 99 extra 16-bit unsigned variables (the editor_seqs). And that per unused screen! Now how to use them? The following script demonstrates (just make sure that it's not attached to any sprite. That may be tricky):

void main( void )
{
  // Stuff here
  // Oh, crud, we need to store things but we ran out of globals.
  // Oh, well. Here goes nothing.
  // &mymap must be a global.
  &mymap = &player_map;
  // Replace 1 by the unused screen you want to use for this extra variable.
  &player_map = 1;
  load_screen();
  editor_seq(12,5);
  &player_map = &mymap;
  load_screen();
}


And retrieving the value? Same thing. Just put the editor_seq(12,-1); in a local variable, then jump back to the original screen:

void main( void )
{
  int &crap;
  // Stuff here
  // Oh, crud, we need to store things but we ran out of globals.
  // Oh, well. Here goes nothing.
  // &mymap must be a global.
  &mymap = &player_map;
  // Replace 1 by the unused screen you want to use for this extra variable.
  &player_map = 1;
  load_screen();
  &crap = editor_seq(12,-1);
  &player_map = &mymap;
  load_screen();
  say_stop("That value you stored six hours ago? &crap",1);
}


I think that should work. It works in a bit of code I'm writing right now, but at that point it's not running any other scripts at the same time. Not sure if already running scripts die when doing load_screen(), or as the first part of draw_screen(). It's even saved into the save game. You'll lose everything if you do a clear_editor_info(), so beware if you do the whole map.dat/dink.dat switching thing.

Anyway: load_screen() gives you access to a screen's editor sprites. They won't have any sp_* attributes, only editor_* attributes. It also won't make any scripts run, not even the screen base script. That all happens after draw_screen() which you should not use.