28
« on: November 15, 2007, 09:04:58 pm »
well, it has three scripts, "ask()" using both so I will post all three.
To Mit "it didn't work, it jus wouldn't load the game..."
any way.
// argument0 = the text
// argument1 = whether or not to draw the box at the end
// argument2 = whether or not to initiate the text
// argument3 = whether or not to draw the text box
// argument4 = the picture to use
// ` = white text
// ^ = red text
// { = blue text
// } = green text
// ‡ = yellow text (Alt + 0135)
global.drawingtext = true;
if (argument2 = true) {
position = 1;
done = false;
}
global.text = argument0;
global.more = argument1;
global.font = sprLettersWhite;
if (keyboard_check(vk_space) = true) {
done = true;
position = string_length(global.text);
curstring = global.text;
keyboard_clear(vk_space);
}
if (done = false) {
curstring = string_copy(global.text, 1, position);
if string_length(curstring) = string_length(global.text) {
done = true;
position = 1;
}
}
if (done = false) {
position += 1
}
if (argument4 != 0) {
draw_sprite(sprPhotoBox, 0, view_xport[0] + 0, view_yport[0] + 116);
draw_sprite(argument4, 0, view_xport[0] + 6, view_yport[0] + 122-16
);
}
if (argument3 = true) {
draw_sprite_ext(sprTextBox, 0, view_xport[0] + 0, view_yport[0] + 160,1,1,0,c_white,0.5);
screen_refresh();
}
pointx = 22-16;
pointy = 166;
for(i = 1; i < string_length(curstring) + 1; i += 1) {
lettertemp = string_copy(curstring, i, 1);
if (pointx >= 290) {
pointx = 22-16;
pointy += 16;
}
if (lettertemp != " " && lettertemp != "~" && lettertemp != "|") {
if (lettertemp != "`" && lettertemp != "^" && lettertemp != "{" && lettertemp != "}" and lettertemp != "¬" and lettertemp != "‡") {
draw_text_sprite(view_xport[0] + pointx, view_yport[0] + pointy, lettertemp, -1, 320, global.font, '!', 1);
pointx += 8;
}
else {
if (lettertemp = "`") {
global.font = sprLettersWhite;
}
if (lettertemp = "^") {
global.font = sprLettersRed;
}
if (lettertemp = "{") {
global.font = sprLettersBlue;
}
if (lettertemp = "}") {
global.font = sprLettersGreen;
}
if (lettertemp = "‡") {
global.font = sprLettersYellow;
}
}
}
if (lettertemp = " ") {
pointx += 8;
}
if (lettertemp = "~") {
pointy += 16;
pointx = 22-16;
}
}
if (lettertemp = "|") {
sleep(100);
}
screen_refresh();
if (done = true && global.more = true) {
draw_sprite(sprTextMore, 0, view_xport[0] + 123, view_yport[0] + 216);
}
if (done = true && argument5 != 0) {
if (argument5 > 2) {
argument5 = 2;
}
if (argument5 == 1) {
draw_sprite(sprTextArrow, 0, view_xview[0] + 22-16, view_yview[0] + 182);
}
if (argument5 == 2) {
draw_sprite(sprTextArrow, 0, view_xview[0] + 22-16, view_yview[0] + 198);
}
}
if (done = false) {
sleep(30);
Say(argument0, argument1, false, argument3, argument4, argument5);
}
else {
screen_refresh();
keyboard_wait();
if (argument5 == 0) {
sleep(30);
}
else {
if (keyboard_lastkey = vk_right || keyboard_lastkey = vk_left || keyboard_lastkey = vk_up || keyboard_lastkey = vk_down) {
if (argument5 == 1) {
argument5 = 2;
}
else {
argument5 = 1;
}
}
if (keyboard_lastkey = vk_space) {
keyboard_clear(vk_space);
return(argument5);
}
else {
Say(argument0, argument1, false, argument3, argument4, argument5);
}
}
}
screen_redraw()
^^^^Say()
//the dialog box w/ a question
//argument0 = The Question
//argument1 = The First Choice
//argument2 = The Second Choice
//argument3 = The Face to use
//argument4 = The choice (optional)
tempstring = string(argument0) + "~ {" + string(argument1) + "~ " + string(argument2);
if (argument4 == 0) {
argument4 = 1;
}
answer = Say(tempstring, false, true, true, argument3, argument4);
return(answer);
^^^^^^^^Ask()
// Sprite Text Draw script 1.3 Final made by Da-Huntha for GM6 (GM5.X has this function
// implented on the same name.
// ©Lostmoment 2004
// ----------------
// THIS ONE WORKS WITH THE UNREGISTERED VERSION OF GAME MAKER 6
// ----------------
// Argument0 = x location of text
// Argument1 = y location of text
// Argument2 = text to draw
// Argument3 = Space between characters
// Argument4 = The width of the text in pixels, when limit is reached the
// rest will be drawn at a new line.
// Argument5 = sprite to use (Use as in GM5 sprites with subimages
// which are correctly alligned with the ASCII order, to
// check this goto Start>Run and type charmap)
// Argument6 = At what character the sprite begins with. (For example
// if the first character on the font sprite is an A (capital)
// then you should set "A" to this. The rest of the characters
// need to keep on the correct ASCII order.
//
DTtext = string(argument2);
DTcurrentchar = 1;
DTdrawchar = 0;
DTcurrentx = argument0;
DTcurrenty = argument1;
DTtotalchar = string_length(DTtext);
if (is_string(argument6)) { DTstarting = ord(argument6); } else { DTstarting = argument6 };
while (DTcurrentchar != DTtotalchar+1) {
if (argument4 > 0) { DTdrawchar += sprite_get_width(argument5)+argument3; }
DTchar = string_char_at(DTtext,DTcurrentchar);
if (DTdrawchar>=argument4&&argument4 > 0) {
DTcurrentchar += 1
if (ord(DTchar) = 32) {
DTcurrentx += (sprite_get_width(argument5)+argument3);
} else {
DTsubstring = (ord(DTchar)-DTstarting);
draw_sprite(argument5,DTsubstring,DTcurrentx,DTcurrenty);
DTcurrentx += (sprite_get_width(argument5)+argument3);
}
DTcurrentx = argument0;
DTcurrenty += sprite_get_height(argument5);
DTdrawchar = 0;
} else {
if (DTchar = "#") {
DTcurrentchar += 1;
DTcurrentx = argument0;
DTcurrenty += sprite_get_height(argument5);
DTdrawchar = 0;
} else {
if (ord(DTchar) = 32) {
DTcurrentx += (sprite_get_width(argument5)+argument3);
} else {
DTsubstring = (ord(DTchar)-DTstarting);
draw_sprite(argument5,DTsubstring,DTcurrentx,DTcurrenty);
DTcurrentx += (sprite_get_width(argument5)+argument3);
}
DTcurrentchar += 1;
}
}
}
^draw_text_sprite()
tanx!