-
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.
-
you could use kbhit() to make it to where if the user presses a key the text speeds up.
-
-
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.