You are not logged in.
This script takes two fonts, where one is used for the numbers in the text and one for the letters.
I made this script for someone who wanted this feature in their game, and so I thought it could be helpful to others, so thought why not put it out on the internet.
/// draw_text_diffont(x, y, text, numbers_font, letters_font)
//
// Draws text with two different fonts combined: one for numbers and one for letters
//
// x x position for text
// y y position for text
// text text to be drawn
// numbers_font font used for numbers
// letters_font font used for letters
//
//Argument vars
var xx = argument0;
var yy = argument1;
var text = argument2;
var n_font = argument3;
var l_font = argument4;
//String length
var str_len = string_length(text);
//Drawn text width
var drawn_w = 0;
for(var i=1; i<=str_len; i++){
//get current letter
var letter = string_copy(text, i, 1);
//set font
if (string_digits(letter)!=""){
draw_set_font(n_font);
}else{
draw_set_font(l_font);
}
//draw letter
draw_text(xx + drawn_w, yy, letter);
//increase drawn width
drawn_w += string_width(letter);
}
Thanks!
Offline
Very interesting script. It's not something I would have ever thought of making but I could see this helping somebody.
Thanks for the submission and welcome to the forums.
Abusing forum power since 1986.
Offline
Thanks Have a good day life.
Offline
Very interesting script. It's not something I would have ever thought of making but I could see this helping somebody.
Thanks for the submission and welcome to the forums.
I don't know how this site works, so I have a question. Is this where the script belongs now, in this thread, or will it be added to the Scripts section of the website?
Thanks.
Offline