The Dink Network

dink xy?

April 5th 2018, 11:18 AM
duckdie.gif
crypto
Peasant They/Them
 
is there a way to store dink's xy, i seen the save_x save_y .... but could not figure out how to make it correspond to dink [ it clearly says it's for monsters ]

if any one has played morrowind..

what i am doing is making a mark and recall ...

now i got the screen saved no issue, and i can set xy for the warp manually.... however there is no way of telling if the x y are save areas [ able to walk ]

so i want to save the xy from where mark is cast ...

the other work around i thought of is to test for every map and set xy individually for each map . but thought surly there is a better way
April 5th 2018, 11:24 AM
spike.gif
Dink is number 1. So, instead of using &current_sprite, you use 1, e.g. &save_x = sp_x(1,-1).

&save_x and &save_y are just regular global variables that the original game uses to spawn goodies on monsters' corpses. For a mark & recall spell, you'll want to create new globals that won't get changed by other scripts...
April 5th 2018, 11:27 AM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
Yes, there is a better way:

sp_x() and sp_y() give you the coordinates for a sprite; Dink is sprite 1, so you can get its coordinates with sp_x(1) and sp_y(1). If you need to mark positions on certain map screens, you can put a sprite there at the coordinate you need. If you give it a special brain (any number that is not used by other sprites on the screen), you can easily find it with get_sprite_with_this_brain().
April 5th 2018, 11:56 AM
duckdie.gif
crypto
Peasant They/Them
 
odd i did try something like that, already ...

perhaps i got something mixed up, alright ... i'll go over the code again .. and ya i have the globals for it .... i was hoping to only need 1 screen number.... and use script_attach(1000) to "hold" locals as x y .

maybe i should ask if that will work ? [ using attach_script(1000) ]

then again i guess it don't matter about making them local i remember seeing in the dev notes, that all vars count for the cap ..... hmm ...... funny limitations dink c has ...... makes it sorta fun working with it ...

Thanks.

----- LOL ya ... forgot a damn , .... it works fine now .
April 5th 2018, 12:40 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
Hmm, that is a good idea. Locals have their own limit AFAIK, or otherwise at least every script will have its own set, so you could have a script (or several scripts) attached to 1000 contain stuff in local variables, which you can then access through run_script_by_number().

I think that should work, but I also think you're likely to run into weirdness that you need to work around.

funny limitations dink c has ...... makes it sorta fun working with it ...
In that case go for it.
April 5th 2018, 01:23 PM
duckdie.gif
crypto
Peasant They/Them
 
Well from the dev notes ..

Maximum number of variables:
With some help and prodding from Sylvain Beucler, I have determined that
the dead maximum number of variables that the dink engine will support is
248. This number is the limit on the total of:
- all make_global_int() commands, plus
- all "int" commands in all active scripts -- see int, kill_this_task(),
and scripts_used() for more comments on this. ]
April 5th 2018, 01:37 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
Really? That number is extremely low then. But indeed, in that case hiding variables in other scripts' locals doesn't help then. So the only thing you can still do is use sprite and map attributes. It's kind of messy to access them though (but not worse than run_script_by_number would have been).