The Dink Network

two questions about maps and scripts

April 6th, 10:42 AM
duckdie.gif
crypto
Peasant
 
Question one: is there a way to attach a script to a map tile in code, like you can for monsters? ... i know you can from the editor [b] and that's fine, but then it's a always say screen 16..
--
if not thought of this work around

thought of having a always running script to remedy this that simply counts screens, and runs "something" every rnd(10) or so screens, i'm sure you all follow me here so not going to put the code for that ..
--

The other question is concerning porting in map files ...

i haven't used windows in a long ass time, and i use /usr/share/ dose windows use \windows\system ... talking about the direction of slashes not the content ...

because i was trying to port in map tiles from other maps like it says it can do... but it just sits there if i try to import... *works from same map*

so i thought maybe it's looking for the other slash, but i tried both ways ...

-- and now i have a third question

So i just had a thought about hardness ... if i copy in a map tile ... it's hardness will be set to the same as it's NEW map correct ?
April 6th, 12:34 PM
peasantm.gif
shevek
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.
April 6th, 01:42 PM
duckdie.gif
crypto
Peasant
 
HMMM alright i guess that's an acceptable workaround, i wanted to make some events totally random ..

so i wanted something that could happen on any screen, but not always trigger... now i could attach a script to every screen with a counter but ...

i was hoping to be able to attach to map tiles on the fly something like this prototype:

if ( something ) { attach script to &player_map } ... which is what i was asking ..

hmm ok well I'll have to mess around with the editor a bit more .... need to start build more map and adding peoples, attaching story and quests .... most of my time has been dumped into scripts ...... i think i have more scripts than i do map tiles ... lots will be DESTROYED before release though..
April 6th, 01:47 PM
wizardg.gif
LeprochaUn
Peasant Male Japan xbox steam bloop
Responsible for making things not look like ass 
so i wanted something that could happen on any screen, but not always trigger... now i could attach a script to every screen with a counter but ...

There is a random() command in dinkC you could use. The original game has some random chance encounters in it.
April 6th, 01:58 PM
duckdie.gif
crypto
Peasant
 
ya Thanks , I was aware of the random function, and have been playing with it..

however it's still pinned to a screen ... I mean that .... if it's set to screen 3 it will only work on screen 3... and while you can make it random for that screen it is rather predicable, not in action perhaps .... but you'll know say if you go to screen 3 x could happen..

actually maybe that will work,
i think i have a plan .... gonna see how it works out
April 6th, 03:01 PM
peasantm.gif
shevek
Peasant Netherlands
Never be afraid to ask, but don't demand an answer 
If it needs to happen when entering the screen, like the traveller who is assaulted by the guards near Stonebrook in the original game, you will need a script attached to the map screen. That is the only way to add new sprites to a screen before it is drawn.

You can add a forever-running script to decide when to trigger the event, but the event itself needs to be in the map screen's script. And if you have that script anyway, there isn't much value in the forever-running script, I think. But I don't know your exact use case, so I could be wrong.
April 6th, 03:56 PM
duckdie.gif
crypto
Peasant
 
Ya thanks,

it's ok, i'll figure out a way, or find a work around i can accept ..

yep, got a work around working .. persistent script with a super long wait() .

needs more testing ... but i think it will work out just fine ...

any thoughts on this ? issue that mite happen or what not ?