The Dink Network

Reply to Re: Main dialogue colour

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
February 8th 2013, 05:16 PM
pillbug.gif
Pillbug
Peasant He/Him United States
Love! True love! 
Alright, I'm terrible at explaining things but the gist of it is: The engine absolutely does not care if we say that choices are different colors, so we have to do the entire things by hand. A lot of the stuff in this script that may seem complicated is really just drawing a choice box and putting text over it. The variable &ch is used to determine which choice we are on, and it is increased or decreased when the player hits the arrow keys, and the choice is redrawn. I've annotated some things, but as I've said, I'm terrible at showing my work. I'll try to troubleshoot problems as they arise, but hopefully it won't be too sloppy.

------
Script
------
The script below is an updated, cleaner version This URL leads to the older version, with checks for a sidequest variable and some censored dialogue.

void main(void)
{
        //This checks if the player has perk 12, the Speech perk.
  external("perks", "getPerk", 12);
  int &speech = &return;
  int &text;
  int &text2;
  int &text3;
  int &text4;
  int &text5;
  int &text6;
  int &text7;
  int &title;
  int &title2;
  int &ch;
  &ch = 1;
  int &kara = get_sprite_with_this_brain(16, &current_sprite);
}
 
void talk(void)
{
 
  if(&speech > 0)
  {
    &ch = 1;
  }
 
  if(&speech < 1)
  {
    &ch = 2;
  }
  freeze(1);
  freeze(&current_sprite);
  wait(100);
 
  //Left, Mid/Mid2, and Right create the choice box
  int &left = create_sprite(151, 286, 0, 30, 2);
  sp_que(&left, 9000);
 
  int &mid = create_sprite(325, 270, 0, 30, 3);
  sp_que(&mid, 9000);
 
  int &mid2 = create_sprite(383, 270, 0, 30, 3);
  sp_que(&mid, 9000);
 
  int &right = create_sprite(525, 285, 0, 30, 4);
  sp_que(&right, 9000);
 
  //1a, 1b, etc. are the wooden arrows that point at the current choice. They are invisible by default.
  int &1a = create_sprite(155, 222, 6, 456, 1);
  sp_nodraw(&1a, 1);
  sp_seq(&1a, 456);
  sp_que(&1a, 9001);
  int &1b = create_sprite(525, 222, 6, 457, 1);
  sp_nodraw(&1b, 1);
  sp_seq(&1b, 457);
  sp_que(&1b, 9001);
  int &2a = create_sprite(155, 245, 6, 456, 1);
  sp_nodraw(&2a, 1);
  sp_seq(&2a, 456);
  sp_que(&2a, 9001);
  int &2b = create_sprite(525, 245, 6, 457, 1);
  sp_nodraw(&2b, 1);
  sp_seq(&2b, 457);
  sp_que(&2b, 9001);
  int &3a = create_sprite(155, 265, 6, 456, 1);
  sp_nodraw(&3a, 1);
  sp_seq(&3a, 456);
  sp_que(&3a, 9001);
  int &3b = create_sprite(525, 265, 6, 457, 1);
  sp_nodraw(&3b, 1);
  sp_seq(&3b, 457);
  sp_que(&3b, 9001);
  int &4a = create_sprite(155, 202, 6, 456, 1);
  sp_nodraw(&4a, 1);
  sp_seq(&4a, 456);
  sp_que(&4a, 9001);
  int &4b = create_sprite(525, 202, 6, 457, 1);
  sp_nodraw(&4b, 1);
  sp_seq(&4b, 457);
  sp_que(&4b, 9001);
  int &5a = create_sprite(155, 205, 6, 456, 1);
  sp_nodraw(&5a, 1);
  sp_seq(&5a, 456);
  sp_que(&5a, 9001);
  int &5b = create_sprite(525, 205, 6, 457, 1);
  sp_nodraw(&5b, 1);
  sp_seq(&5b, 457);
  sp_que(&5b, 9001);
  int &6a = create_sprite(155, 162, 6, 456, 1);
  sp_nodraw(&6a, 1);
  sp_seq(&6a, 456);
  sp_que(&6a, 9001);
  int &6b = create_sprite(525, 162, 6, 457, 1);
  sp_nodraw(&6b, 1);
  sp_seq(&6b, 457);
  sp_que(&6b, 9001);
  int &7a = create_sprite(155, 285, 6, 456, 1);
  sp_nodraw(&7a, 1);
  sp_seq(&7a, 456);
  sp_que(&7a, 9001);
  int &7b = create_sprite(525, 285, 6, 457, 1);
  sp_nodraw(&7b, 1);
  sp_seq(&7b, 457);
  sp_que(&7b, 9001);
 
  //////CHOICES
  //We aren't using an actual choice menu, so we have to make the title ourselves.
  &title = say_xy("`3Title", 25, 115);
  //Title never dies (it's just missing in action)
  sp_kill(&title, 0);
  //Loop to draw text in correct colors
loop:
  freeze(1);
  wait(1);
  //nodraw ALL the arrows
  sp_nodraw(&1a, 1);
  sp_nodraw(&1b, 1);
  sp_nodraw(&2a, 1);
  sp_nodraw(&2b, 1);
  sp_nodraw(&3a, 1);
  sp_nodraw(&3b, 1);
  sp_nodraw(&4a, 1);
  sp_nodraw(&4b, 1);
  sp_nodraw(&5a, 1);
  sp_nodraw(&5b, 1);
  sp_nodraw(&6a, 1);
  sp_nodraw(&6b, 1);
  sp_nodraw(&7a, 1);
  sp_nodraw(&7b, 1);
 
  sp_active(&text, 0);
  //The choice is 1, so we nodraw(0) the arrows and create some standard text (In White, since it's selected)
  if(&ch == 1)
  {
    sp_nodraw(&5a, 0);
    sp_nodraw(&5b, 0);
    &text = say_xy("`%Option 1",25,190);
   
  }
 
  external("perks", "getPerk", 12);
  int &speech = &return;
  if(&ch != 1)
  {
    if(&speech > 0)
    {
      &text = say_xy("`0Option 1 - Green",25,190);
    }
   
    if(&speech < 1)
    {
      &text = say_xy("`7Option 1 - Grey",25, 190);
    }
   
  }
 
  sp_kill(&text, 0);
  sp_que(&text, 9001);
 
  sp_active(&text2, 0);
  if(&ch == 2)
  {
    sp_nodraw(&1a, 0);
    sp_nodraw(&1b, 0);
    &text2 = say_xy("`%Option 2 - Selected",25, 210);
  }
 
  if(&ch != 2)
  {
    &text2 = say_xy("`!Option 2 - Not Selected",25, 210);
   
  }
  sp_kill(&text2, 0);
 
  sp_active(&text3, 0);
  if(&ch == 3)
  {
    sp_nodraw(&2a, 0);
    sp_nodraw(&2b, 0);
    &text3 = say_xy("`%Option 3 - Selected?",25, 230);
  }
 
  if(&ch != 3)
  {
    &text3 = say_xy("`!Option 3 - Not Selected", 25, 230);
  }
 
  sp_kill(&text3, 0);
  sp_que(&text3, 9001);
 
 
 
  sp_active(&text4, 0);
  if(&ch == 4)
  {
    sp_nodraw(&3a, 0);
    sp_nodraw(&3b, 0);
    &text4 = say_xy("`%Option 4 - Selected",25, 250);
  }
 
  if(&ch != 4)
  {
      &text4 = say_xy("`!Option 4 - Not Selected",25, 250);
  }
  sp_kill(&text4, 0);
 
 
 
 
 
 
  sp_active(&text5, 0);
  if(&ch == 5)
  {
    sp_nodraw(&7a, 0);
    sp_nodraw(&7b, 0);
    &text5 = say_xy("`%Option 5 - Selected",25, 270);
  }
 
  if(&ch != 5)
  {
   
    &text5 = say_xy("`!Option 5 - Not Selected",25, 270);
  }
  sp_kill(&text5, 0);
 
 
 
  //18 is up, 12 is down
  wait_for_button();
  //Regular choice menus allows for left and right as well. We're just as good as them!
  if(&result == 14)
  {
    goto down;
   
  }
 
  if(&result == 16)
  {
    goto up;
  }
 
  if(&result == 1)
  {
  //Kill all the stuff, we're choosing things now
    playsound(17,22050,0,0,0);
    sp_active(&text, 0);
    sp_active(&text2, 0);
    sp_active(&text3, 0);
    sp_active(&text4, 0);
    sp_active(&text5, 0);
    sp_active(&left, 0);
    sp_active(&mid, 0);
    sp_active(&mid2, 0);
    sp_active(&right, 0);
    sp_active(&title, 0);
    sp_active(&title2, 0);
    sp_active(&1a, 0);
    sp_active(&1b, 0);
    sp_active(&2a, 0);
    sp_active(&2b, 0);
    sp_active(&3a, 0);
    sp_active(&3b, 0);
    sp_active(&4a, 0);
    sp_active(&4b, 0);
    sp_active(&5a, 0);
    sp_active(&5b, 0);
    sp_active(&6a, 0);
    sp_active(&6b, 0);
    sp_active(&7a, 0);
    sp_active(&7b, 0);
   
    if(&ch == 1)
    {
    //They picked option 1! Option 1 things here!
    unfreeze(1);
        unfreeze(&current_sprite);
        return;
    }
   
    if(&ch == 2)
    {
        //Option 2
      unfreeze(1);
      unfreeze(&current_sprite);
      return;
    }
   
   
   
   
    if(&ch == 3)
    {
        //Option 3
      say_stop("Spoilers.",1);
      unfreeze(1);
      unfreeze(&current_sprite);
      return;
    }
   
    if(&ch == 4)
    {
      //Option 4
          unfreeze(1);
          unfreeze(current_sprite);
          return;
     
    }
   
   
   
    if(&ch == 5)
    {
        //Option 5
      unfreeze(1);
      unfreeze(&current_sprite);
      return;
    }
   
  }
 
 
 
  if(&result == 12)
  {
down:
    playsound(11,22050,0,0,0);
    freeze(1);
    if(&ch == 1)
    {
      &ch = 2;
      goto loop;
    }
   
    if(&ch == 2)
    {
      &ch = 3;
      goto loop;
    }
   
    if(&ch == 3)
    {
      &ch = 4;
      goto loop;
    }
   
    if(&ch == 4)
    {
      &ch = 5;
      goto loop;
    }
   
    if(&ch == 5)
    {
      if(&speech > 0)
      {
        &ch = 1;
      }
     
      if(&speech < 1)
      {
        &ch = 2;
      }
      goto loop;
    }
   
   
  }
 
  if(&result == 18)
  {
up:
    freeze(1);
    playsound(11,22050,0,0,0);
    if(&ch == 1)
    {
      &ch = 5;
      goto loop;
    }
   
    if(&ch == 2)
    {
     
      if(&speech > 0)
      {
        &ch = 1;
      }
     
      if(&speech < 1)
      {
        &ch = 5;
      }
      goto loop;
    }
   
    if(&ch == 3)
    {
      &ch = 2;
      goto loop;
    }
   
    if(&ch == 4)
    {
      &ch = 3;
      goto loop;
    }
   
    if(&ch == 5)
    {
      &ch = 4;
      goto loop;
     
    }
   
    else
    {
      goto loop;
    }
    //unfreeze(1);
    //unfreeze(&doc);
    //say("Not right now, thanks.",1);
    //return;
  }
 
  goto loop;
}