Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Help me with TRW text engine  (Read 1319 times)

0 Members and 1 Guest are viewing this topic.
Help me with TRW text engine
« on: November 14, 2007, 09:13:14 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 61
hi all! I have a small problem with TRW text engine, I got the ask script to work(turns out it's just a small GM5 script when it should be GM6) anyway how do I make it "if answer1 do this, if answer is 2 do this."
Logged
Re: Help me with TRW text engine
« Reply #1 on: November 15, 2007, 12:58:41 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
...Could you show us the codes in the Ask script?(I don't have the engine so I don't know what this scripts does, if you tell us it'll be easier to help you out)
Logged
This is an english website, please speak it.
l0l wut? o_0

mit

Re: Help me with TRW text engine
« Reply #2 on: November 15, 2007, 04:43:25 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Wasn't the engine upgraded from GM4.3? Even if it wasn't it's incredibly old and overly complicated.

If the ask script returns the option they chose, you can do something based on that like this:
Code: [Select]
if ( ask("Question")=true ) {
 //Do something
} else {
 //Do something else
}

Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games
Re: Help me with TRW text engine
« Reply #3 on: November 15, 2007, 09:04:58 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 61
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.

Code: [Select]
// 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()

Code: [Select]
//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()


Code: [Select]
// 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!
Logged

mit

Re: Help me with TRW text engine
« Reply #4 on: November 15, 2007, 09:46:13 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Quote
To Mit "it didn't work, it jus wouldn't load the game..."
What do you mean?

If it gave an error, what was it?
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games
Re: Help me with TRW text engine
« Reply #5 on: November 15, 2007, 10:14:24 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
That seems too complicated/Confusing...Try this:
Code: [Select]
password_real="a"; //change a for the first answer
password_real2="b"; //change b for the second answer
password_entered=get_string('Whats the right answer?','');

if (password_real==password_entered or password_real2==password_entered){
show_message("Correct!");//What it does if the answer it's right
}else{
show_message("Wrong Answer, Try again!");//What it does if the answer it's wrong
}
password_real is the first answer, change the a for the first answer
password_real2 is the secodn answer, try that and whenever you enter the letter b or a it will show the message "Correct!" else it will show the other message "Whats the right answer?.
Try that and see if it works, if it does then I guess it's a good step in the right direction, now you'll need to make it appear in the text box using the other script and I'm not so good with gamemaker so someone like Mit could help more than I can on that one.
Logged
This is an english website, please speak it.
l0l wut? o_0

Antidote

>.>
Re: Help me with TRW text engine
« Reply #6 on: November 16, 2007, 03:56:47 am »
  • In all seriousness who's serious?
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1485
That code is so old and i'm certain that TRW said it was an example of how to get it working and that it wasn't optimized. In fact it's easier to use font_create_sprite() (er it's been awhile) and to write a simple 3 line script to create a "Typewriter" effect. it's so well known that all engines needing this style use what i've described <.<
Logged
  • Axiomatic Data Laboratories
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.483 seconds with 51 queries.