Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Carriage returns in text

Author
Message
KareDev
12
Years of Service
User Offline
Joined: 6th Feb 2012
Location:
Posted: 17th Mar 2012 19:23
Hey all, when using onscreen text (like the setText commands etc.) what character can I put in the string to cause a carriage return?
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 18th Mar 2012 00:53
chr(10)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Mar 2012 14:48
You can't use Returns in AppGameKit text, you'll have to do that manually with multiple strings of text

KareDev
12
Years of Service
User Offline
Joined: 6th Feb 2012
Location:
Posted: 18th Mar 2012 16:29
Hi BatVink, it seems Marl's suggestion of using "chr(10)" worked. So I can do this:

test = "This is a string with"+chr(10)+"a carriage return mid-sentence."

It seems to work fine for me. Is there some reason I shouldn't do this if it seems to be working OK?
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Mar 2012 22:47
This method does work. I use it myself in my projects.

My signature is NOT a moderator plaything! Stop changing it!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Mar 2012 23:51
If it works, then you just saved a lot of time

I still like to work line by line so I can fade text in and out, but for straight text I may use this myself.

Stormwire
14
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 19th Mar 2012 01:27 Edited at: 19th Mar 2012 01:30
This doesnt make sense. I have tried this before and it didnt work but when I use the following code it works.



If I use chr(13) for when the key is pressed and then add in a chr(10) to make the string move to a different line. It doesnt make sense Anybody know why this works this way. Is cr chr(10) or chr(13)? If I use chr(10) for both or chr(13) then the string doesnt move to the next line and neither does my cursor. Whats going on?

cx and cy are values for cursor position. keypressed is the last key that was pressed. cursor is the ID for my sprite (a blinking square).
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 19th Mar 2012 10:00
chr(13) is carriage return
chr(10) is line feed

In the olden days, both were used, chr(13) returned the cursor to the start of the line and chr(10) moved it down a line.

Most modern computers now just use one or the other and as a result there is sometimes compatibility issues between systems.
Stormwire
14
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 20th Mar 2012 00:41
Thanks Marl that was realy helpful.

Login to post a reply

Server time is: 2024-11-23 05:28:55
Your offset time is: 2024-11-23 05:28:55