The Dink Network

Reply to Re: two questions about maps and scripts

If you don't have an account, just leave the password field blank.
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
April 6th 2018, 12:34 PM
Peasant Netherlands
Never be afraid to ask, but don't demand an answer 
is there a way to attach a script to a map tile in code, like you can for monsters?
I'm not sure if I understand your question. If you want the script to run when a certain tile is talked to, then no that is not possible. You can however place an invisible sprite on the tile and attach the script to that. Is that what you want?

thought of having a always running script to remedy this that simply counts screens, and runs "something" every rnd(10) or so screens
You do not receive an event on screen change, and it is a bad idea to have the script constantly checking if the screen has changed (it keeps your cpu busy for no reason). A better way to do that is to attach a script to all screens where you want this effect. Those scripts will be called when the screen is entered, so they can decrement a counter and do something when it's 0, then set it back to rnd(10).

Also this seems to be a completely different thing from what your first question was. Or do you mean a screen when you write "map tile"? In that case yes, that is possible.

As for the slashes: Pretty much every system nowadays accepts forward slashes. That includes Windows. Windows also accepts backslashes. Because Dink was originally written for Windows, it uses backslashes for all its paths internally. FreeDink makes sure that this works on systems that don't normally support it. So for your scripts, it doesn't matter what type of slash you use; they both work. I recommend forward slashes, because backslashes need to be doubled in C strings; not sure if DinkC copied that feature.

I don't know about the hardness, someone else will have to answer that.