Thread: Sweet For Text Rpg's

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    58

    Sweet For Text Rpg's

    Delayed Messages (edit as needed) use this function


    [code]
    int mesg(int j, char message[50000])
    {
    int i;

    for(i=0; i<j+1; i++)
    {
    int p=50;
    cout<<message[i];
    Sleep(p);
    }
    return 0;
    }

    that will delay each letter of a message giving the cool typing effect. You can figure out how it works but if you cant (i was a n00b once too) its ran like this

    #include <iostream.h> //NECESSARY
    #include <windows.h> //Needed for the Sleep();note Sleep
    //is spelled with a capitol S.
    int main()
    {
    mesg(11, "Hello World");
    return 0;
    }

    the 11 in the first colom makes sure that unnecessary text is not printed if you let it go it would print out random charictors set it to the length of your message enjoy
    NOTE: Sleep(); is set in Milliseconds.
    --== www.NuclearWasteSite.com==--

  2. #2
    you could use kbhit() to make it to where if the user presses a key the text speeds up.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    58
    oh? how?
    --== www.NuclearWasteSite.com==--

  4. #4
    Code:
    int mesgflag=0;
    
    int mesg(int j, char message[50000]) 
    { 
    int i; 
    
    for(i=0; i<j+1; i++) 
    {
    if (kbhit())
    mesgflag=1; 
    int p=50; 
    cout<<message[i]; 
    if (mesgflag==0)
    Sleep(p); 
    } 
    return 0; 
    }
    I haven't tried that yet, but it might work. If it doesn't work it's in the if (kbhit()) line. I forget the real sytax for kbhit(), I think that is it though.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sweet Sweet Caffinee
    By Thantos in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 12-14-2004, 01:22 PM
  2. sweet deal on a book
    By kermit in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-11-2003, 06:12 PM
  3. Text RPGS
    By LouDu in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 05-29-2003, 11:31 AM
  4. Everyone look at my totally sweet spaceship
    By Shadow12345 in forum Game Programming
    Replies: 4
    Last Post: 09-30-2002, 02:27 PM
  5. how to make RPG's?
    By Unregistered in forum Game Programming
    Replies: 5
    Last Post: 09-18-2001, 12:16 AM