The Dink Network

script organisation level over 9000

March 27th 2021, 06:53 PM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
Why am I just discovering this now?

And also, did this just not get used, or did no one know about it, because I haven't seen it used in a dmod.

I'm talking about this:

I didn't know you could organise your scripts into subdirectories and just include it in the script name and it works.. lolz.
makes for more organised story folder I guess.
You could actually have scripts of the same names in different subdirectories for each area instead of like "s1-blah".
Folders named: s1, s2 and both have "blah"

it works in all scripting commands and also attaching in the editor just instead of "blah" in the script box put like "s1/blah"
and these work too (direcotry names are examples, obviously):
sp_script(&sprite, "s1/blah");
spawn("common/blah");
external("common/blah", "blah");
March 27th 2021, 07:09 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Huh... I bet you could .. and steal scripts out of other dmods, too?
March 27th 2021, 07:34 PM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
Yep, I just tested that and it works indeed
March 27th 2021, 07:47 PM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
Double post but oh well.

I just realised, that this could present a way in FreeDink to carry over save data from a previous dmod, to a sequel, using DinkC only.

In FreeDink, you could technically use this to carry across save data to a sequel, because there's a strange thing where sp_custom() data stored with Dink, carries across to a loaded game, unless you restart the .exe (then it reads it as it was at time of save)

So you could do something like:
//transfer.c
void main(void)
{
 int &junk;

  //after clicking a custom button on title screen "new game with transfer save data" or something
 save_game(99);
  spawn("../../dmod1/savegame");
 load_game(99);

&junk = sp_custom("strength", 1, -1);
&stregnth = &junk;

//etc...

}


//savegame.c in dmod1:
void main(void)
{
 choice_start();
 set_y 240
 title_start();
 "please select your save data you would like to transfer"
 title_end();
 (normal save choices here)
 choice_end();

 load_game(&result);

 //use custom keys attached to dink to transfer whatever over
sp_custom("strength", 1, &strength);
sp_custom("defense", 1, &defense);
// etc..

kill_this_task();
}


I haven't tested that, but that sp_custom quirk is definitely a thing, so this would work, just would need to test it and probably tweak it if any errors.
It just serves as an example, but yes this is very possible in FreeDink now, knowing this subdirectory thing and the sp_custom trick.

And paired with my version checker, you could make this an option ONLY IF the player is using freedink, so it doesn't cause any errors.

EDIT:
OR maybe not, I forget the save/load game would probably still default to the current dmod directory.. almost possible though.. damn

EDIT2:
Still possible with the sp_custom trick though.. just instruct the player to copy the save.dat into the current dmod in the readme, and then do it locally I guess.
March 27th 2021, 08:34 PM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
The only d-mod to my knowledge that uses subdirs is Dink Mines by Beuc as part of the one-screen d-mod challenge. Also doesn't that ability for path traversal have really interesting potential for abuse?
March 28th 2021, 02:52 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
I ran a stream of me scripting from scratch, the previous theory I posted about transferring save file data (even editor info) out of your old dmod, into the current one... anything, even items.
here's the recorded video. It was a stuff around video, so it's all over the place, and you get to see me go "wtf?", troubleshoot and overlook basic things, as you do in Dinkc:
DinkC scripting and stuff

starts properly around 10 minute mark. First 10 minutes is OCremix radio while I set up.