Hello! I am new and have just gotten started on my first app. When i go through the example they show me… it says to type this…
myText = display.newText( “Hello, World!”, 20, 40, native.systemFont, 36 )
myText:setTextColor( 255,0,0 )
I do that and then when i relaunch my simulator it doesn’t work!
Could somebody recommend what i might be going wrong?
~ Madeline(: [import]uid: 19141 topic_id: 5205 reply_id: 305205[/import]
Can someone please help? [import]uid: 19141 topic_id: 5205 reply_id: 17303[/import]
http://developer.anscamobile.com/forums/new-users-start-here [import]uid: 12108 topic_id: 5205 reply_id: 17306[/import]
What does it say when it doesn’t work? Are you saving the text file as main.lua? Otherwise it won’t work. [import]uid: 10835 topic_id: 5205 reply_id: 17361[/import]
Ignaciolturra, thankyou for replying!
I do exactly what it says, which is typing the code and then saving as a main.lua… Then once i save i open it in my Corona Simulator. When i open it, it doesnt work it is just a black iPhone screen.
Can you walk me through how to just put plain text in? [import]uid: 19141 topic_id: 5205 reply_id: 17535[/import]
First instead of opening the simulator, open the terminal. It will open the simulator automatically, but you’ll be able to see the output of print files and errors there.
The particular hello world you are doing outputs to the terminal and not to the screen! That’s why you weren’t seeing anything.
I believe there was another Hello World that would output to the screen a little below on the same page. Though get into the habit of opening the terminal first. It’s really useful. [import]uid: 10835 topic_id: 5205 reply_id: 17540[/import]
Hello! thanks again for replying!!
How do i open the terminal?? [import]uid: 19141 topic_id: 5205 reply_id: 17542[/import]
Aaaargh the server seems to have eaten my reply.
Here it goes again:
You are not doing anything wrong, it’s actually working. It’s just that the hello world you’re doing outputs to the terminal, not the device screen.
Instead of opening the simulator, open the terminal. It will also open the simulator automatically. In there you’ll see print statements in your code (in this case “Hello World”) and also error logs. Get in the habit of using the terminal, it’s really useful.
There’s another Hello World in there that outputs to the screen
Edit: Huh, I guess it didn’t. [import]uid: 10835 topic_id: 5205 reply_id: 17541[/import]
In Applications, Corona.243 the Corona Terminal icon is right next to the simulator one. Just click on it. [import]uid: 10835 topic_id: 5205 reply_id: 17543[/import]
Okay it opened a word like document??
and says process completed at the end of it?? [import]uid: 19141 topic_id: 5205 reply_id: 17544[/import]
I did, but it says on the terminator
ERROR: Could not find “Corona Simulator.app” in: /Applications/Corona.243
logout
[import]uid: 19141 topic_id: 5205 reply_id: 17548[/import]
Yes. The icon is a black screen with >_ on it.
Now load your main.lua again in the simulator and you should see “Hello World” displayed in the terminal window.
Edit: Wait I got mixed up. The hello world you’re doing will output to the screen. Are you sure you’re opening up the right main.lua?
In the simulator go to file, open and the you have to find the folder where you saved the main.lua
If it doesn’t work then check what the terminal says.
[import]uid: 10835 topic_id: 5205 reply_id: 17547[/import]
this is what the whole thing says :
Last login: Thu Jan 20 11:13:33 on console
/Applications/Corona.243/Corona\ Terminal ; exit;
admin-admins-Mac-mini:~ Mac2$ /Applications/Corona.243/Corona\ Terminal ; exit;
ERROR: Could not find “Corona Simulator.app” in: /Applications/Corona.243
logout
[Process completed]
[import]uid: 19141 topic_id: 5205 reply_id: 17550[/import]
That means for some reason the simulator is not in the correct folder. Did you by any chance move it somewhere else? Reinstalling Corona would probably fix that. [import]uid: 10835 topic_id: 5205 reply_id: 17551[/import]
okay ill reinstall it… then i will get back to you… [import]uid: 19141 topic_id: 5205 reply_id: 17552[/import]
OKAY! i think its fixed, now it says:
Last login: Thu Jan 20 12:48:59 on ttys000
admin-admins-Mac-mini:~ Mac2$ /Applications/Corona.243/Corona\ Terminal ; exit;
[import]uid: 19141 topic_id: 5205 reply_id: 17553[/import]
Now when i open it in my simulator, the terminal says:
Last login: Thu Jan 20 12:48:59 on ttys000
admin-admins-Mac-mini:~ Mac2$ /Applications/Corona.243/Corona\ Terminal ; exit;
Copyright © 2009-2010 A n s c a , I n c .
Version: 2.0.0
Build: 2010.243
The file sandbox for this project is located at the following folder:
(/Users/adminadmin/Library/Application Support/Corona Simulator/TEST-CAFFD9E75DAA83643743D829EC6538A7)
Syntax error: /Users/adminadmin/Desktop/TEST/main.lua:1: unexpected symbol near ‘?’
The code i wrote on my main.lua was:
Local text = display.newText(“ Hello World!” , 50,50,nil, 26)
text:setTextColor(255,255,255)
what does it mean unexpected symbol near “?”
[import]uid: 19141 topic_id: 5205 reply_id: 17555[/import]
Lua is case sensitive. Just copy/paste the text in the hello world sample to see if it works.
For example Local, should be local.
Also what program are you using to create the code? You shouldn’t use something like Word since it adds formatting stuff that will break you code. In the new users sections of the docs there are some good recommendations for text editors. [import]uid: 10835 topic_id: 5205 reply_id: 17557[/import]
Okay.
and yes i am using word… i think ill try text edit, or download text wrangler
[import]uid: 19141 topic_id: 5205 reply_id: 17558[/import]
THANKYOU SO MUCH!!!
Everything it working now and i am thrilled!!!
One more question…
How in the world do you know what codes to use if you wanna put in a background or make a background fit the whole screen??
is there a list of codes i can print out to have with me?? [import]uid: 19141 topic_id: 5205 reply_id: 17560[/import]