The Dink Network

Position of text

September 16th 2013, 06:04 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Is there a way to edit how far above the deaph-dot of characters their say()-command should write the text? Without editing the source code, that is?

September 16th 2013, 06:16 PM
wizardg.gif
leprochaun
Peasant He/Him Japan bloop
Responsible for making things not look like ass 
You can use say_xy/say_stop_xy. Though that way's a little annoying when trying to find the right points.
September 16th 2013, 06:21 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Hmm..yeah...I'd have to check the x and y of the sprite(s) before every conversation.. :/

I guess I'll just set the depth-dot lower... Thanks anyway
September 16th 2013, 07:05 PM
wizardg.gif
leprochaun
Peasant He/Him Japan bloop
Responsible for making things not look like ass 
If you're going to change the depth dot make sure you do it for all frames.
September 16th 2013, 07:16 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
You can also record the sprite number of the said text and move it later:

int &spr = say ("text", &sprite);
int &y = sp_y (&spr, -1);
&y += 10;
sp_y (&spr, &y);


Note that I'm not used to writing "raw" DinkC, so my code may not work, but I hope you get the idea.
September 16th 2013, 07:38 PM
custom_coco.gif
cocomonkey
Bard He/Him United States
Please Cindy, say the whole name each time. 
Actually, I think (though I am just getting back into scripting) that it'd work just as you put it there. Since the text is a sprite, you can just tell the script to move its location like any other sprite.
September 16th 2013, 07:57 PM
spike.gif
Unfortunately, I don't think that works. The text sprite realigns itself constantly (to stay on top of moving sprites, I assume), so although the text might flicker for some milliseconds, it doesn't stay at the new coordinate.
September 16th 2013, 08:05 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Oh, but there's a trick for that, too. The sp_strength() and sp_defense() attributes of a text sprite control the x and y offset of the text relative to the depth dot of its "parent". I forgot which of the two is x, and which is y, but pretty sure it's in dinkc.chm, on the sp_strength() and sp_defense() pages.

Alternatively, first say() an empty text, or just spaces, then get its sp_x() and sp_y(), then say_[stop_]xy() all following lines at whatever coordinates. Maybe that works.
September 16th 2013, 08:18 PM
spike.gif
Oh, awesome. I remember reading that, but totally forgot about it.

Alternatively, first say() an empty text, or just spaces, then get its sp_x() and sp_y(), then say_[stop_]xy() all following lines at whatever coordinates. Maybe that works.

That works. E.g.
void talk
int &mesay = say("`%<- Pub",&current_sprite)
int &mex = sp_x(&mesay,-1)
int &mey = sp_y(&mesay,-1)
&mex -= 235
&mey += 20
say_xy("`%-> Inn",&mex,&mey)

void hit
say("I want hanging signs!",1)
}
September 17th 2013, 07:08 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Oh wow, that's a neat trick, would have saved me some time on stuff I've been working on lately xD