string variable trouble

Started by guv, Thu 06/08/2009 20:49:44

Previous topic - Next topic

guv

i have this  because i want the player to be able to name their characters.

Display("So %s!", playername  you have been kicked out of your flat because of lack of money.");

i created a string variable (thank you densming) but it says that

end of input reached in middle of expression


any help[ appreciatred

NsMn

Uhm, you have the wrong order. It must be like this:

Display("So %s! You have been kicked out blah blah blah.", playername);


densming

Maybe I should have made it clearer in the videos.  The %s is just a placeholder for your string variable.  So just treat %s as if it's the playername (or whatever the string is) in your quoted string as in NsMn's example.  Likewise, you can use %d for integers, and you can even put more than one placeholder in a string, like this:

Display("So %s! You have been kicked out of your flat because you don't have %d coins!", playername, priceOfFlat);

Just put the variables in the same order as the placeholders.

See this page for more help: http://www.adventuregamestudio.co.uk/manual/StringFormats.htm

SMF spam blocked by CleanTalk