set text based on count variable.

Non-platform specific questions.

set text based on count variable.

Postby Hyperyon » Wed Sep 13, 2006 6:28 pm

How do I set text of actor in script editor?
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby makslane » Wed Sep 13, 2006 7:14 pm

You need to use the strcpy function:

Code: Select all
strcpy(text, "your text here");
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hyperyon » Thu Sep 14, 2006 2:07 am

It gives me 'warning: trying to convert from cos int to '* const char' after I put in the text.

here is the code i used:

count++;

if(count==1)
{
strcpy(thetext.text, 12);
}


I'm trying to change a text from image file.
'the text' is my text actor
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby makslane » Thu Sep 14, 2006 4:02 am

If you need set a number, use:

Code: Select all
thetext.textNumber =  12;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hyperyon » Tue Sep 19, 2006 8:59 pm

Im still not getting part of this... :oops:

I got 2 actors. Text (with text from true type)and keydown actor with a keydown event/script editor/

count++;

if (count==1)
{
strcpy(ttext.text, "greetings");
}
else if(count==2)
{
strcpy(ttext.text, "how are you?");
}


When I press the keydown, the text changes forward into count2 ("how are you") instead of the first text.

Maybe im doing it wrong in the 'copy string' window that pops up when i click on strcpy from variables/functions?
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby Game A Gogo » Tue Sep 19, 2006 9:54 pm

put the count++ aftyer the code.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Hyperyon » Tue Sep 19, 2006 11:30 pm

Now it just shuffles the texts without stopping.
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby Game A Gogo » Tue Sep 19, 2006 11:32 pm

mmmmm, maybe its because thatthe action is always repeated.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Hyperyon » Tue Sep 19, 2006 11:38 pm

ah, I dunno what I'm doing wrong...guess I'll resort to learning C.
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest