Jump to content


Photo

The best way to do dialog (Solved)

solved

Best Answer thegame, 28 March 2016 - 07:19 PM

I would suggest using a ds_queue, and just displaying them until the queue is empty.

Basically, you would just have an object check if there is anything in this dialog queue each step, and if there is do some displaying things.

Then your scr_text would basically just ds_queue_enqueue the text, and any other data necessary.
On space would be basically a ds_queue_dequeue, and then some dialog end stuff if you need to close the box or anything.

I have a few examples of this in my signature if you want to see it in action.\

Edit: fixed the font tags ... whoops Go to the full post


  • Please log in to reply
3 replies to this topic

#1 TheNeonGamers

TheNeonGamers

    GMC Member

  • New Member
  • 2 posts
  • Version:GM:Studio

Posted 28 March 2016 - 07:03 PM

Hi everybody!

 

I'm currently using switch to change the dialog when there's a conversation but i don't know if this is the best way to do it

 

Here is an example:

Create:

dialog = 0;

Step:

if room = rm_Talk   
{
    if keyboard_check_pressed(vk_space) and global.fin = 1 
    {
        dialog+=1; 
        switch(dialog)  
        {     
        case 1: scr_text("An hour has passed since he left... I didn't think this could happen",fnt_Tristan,0.8,self.x+100,self.y);
        break;    
        case 2: scr_text("I didn't know even he would do this",fnt_Tristan,0.8,self.x+100,self.y);
        break;         
        case 3: scr_text("Why did he do this?",fnt_Tristan,0.8,self.x+100,self.y);
        break;
        case 4: scr_text("Great just great",fnt_Tristan,0.8,self.x+100,self.y);
        break; 
        case 5: scr_text("Oh no, the side effects are kicking in...",fnt_Tristan,0.8,self.x+100,self.y);
        break; 
        case 6: scr_text("*Falls over and hits the floor*",fnt_Tristan,0.8,self.x+100,self.y);   
        break; 
        case 7: with(ob_TristanFace){instance_destroy();}      
                scr_text("Ahh... It is so sad to see you like this",fnt_Charleton,0.8,self.x+100,self.y);             
        break;     
        case 8: scr_text("I AM GOING TO KILL YOU",fnt_CCharleton,0.8,self.x+100,self.y); 
        break;
        case 9: room_goto_next();
        break;
        }          
    }
}

The scr_text is a script function

 

 


Edited by TheNeonGamers, 28 March 2016 - 08:15 PM.

  • 0

#2 snorgar

snorgar

    GMC Member

  • GMC Member
  • 291 posts
  • Version:Unknown

Posted 28 March 2016 - 07:19 PM

Seems like a good way to say the least. Another way is to save them in arreys

 

talk[1,1] = "This is talk for conversation number one the first line";

talk[1,2] = "This is talk for conversion number one the second line";

 

And have a conversation variable being the first variable than the line variable for the second but it is just another way and not necessarily better.


  • 0

#3 thegame

thegame

    OinkIguana

  • GMC Member
  • 1549 posts
  • Version:GM:Studio

Posted 28 March 2016 - 07:19 PM   Best Answer

I would suggest using a ds_queue, and just displaying them until the queue is empty.

Basically, you would just have an object check if there is anything in this dialog queue each step, and if there is do some displaying things.

Then your scr_text would basically just ds_queue_enqueue the text, and any other data necessary.
On space would be basically a ds_queue_dequeue, and then some dialog end stuff if you need to close the box or anything.

I have a few examples of this in my signature if you want to see it in action.\

Edit: fixed the font tags ... whoops

Edited by thegame, 28 March 2016 - 07:20 PM.

  • 0

Examples: Inventory and Shop Example ||| Dialog System with messages, questions, input and more ||| Old dialog box example (May not work in new versions of GM:Studio)
Jam Games: 11: Abby and Elliot - 21st place ||| 12: Forks - 16th place ||| 13: White - 19th place
Completed games: White


#4 TheNeonGamers

TheNeonGamers

    GMC Member

  • New Member
  • 2 posts
  • Version:GM:Studio

Posted 28 March 2016 - 08:12 PM

I would suggest using a ds_queue, and just displaying them until the queue is empty.

Basically, you would just have an object check if there is anything in this dialog queue each step, and if there is do some displaying things.

Then your scr_text would basically just ds_queue_enqueue the text, and any other data necessary.
On space would be basically a ds_queue_dequeue, and then some dialog end stuff if you need to close the box or anything.

I have a few examples of this in my signature if you want to see it in action.\

Edit: fixed the font tags ... whoops

 

Thanks!

I will check out ds_queue cause it seems useful when the game has multiple languages and using ini seems much cleaner than writing it directly into the code.


  • 0





Also tagged with one or more of these keywords: solved