hey there (+ newbie questions)

Find quick help here to get you started with Hollywood
Post Reply
Arminius
Posts: 10
Joined: Tue Sep 01, 2015 7:33 am

hey there (+ newbie questions)

Post by Arminius »

So first off a "Hi there!" to everyone, I'm new to the forums and just got Hollywood yesterday. (Well, bought it last week, but didn't have the time to snoop into it). I'm about to return to the Amiga community and in the process of buying a SAM 460 machine. Yaay! I bought Hollywood because all those articles in the Amiga Future aroused my interest over the years. I've been doing away with the built-in guide, which helped answering lots of my questions already. However, upon playing around with the IDE under windows I ran into a problem. (info: I have a "webby" background (javascript / php) so you know where I'm coming from)

First problem - I can't use a global variable in my function. To give you an idea:

Code: Select all

/*** Global variable ***/
score = 0

Function p_score()
	TextOut(#RIGHT, #TOP, "Your score:" + score)	
	...
EndFunction
This throws an error "Wrong operator for this type!" in the console. So it'll only take a string here? What did I do wrong?


WordWrap:
Also wondering as for how to use the WordWrap parameter on TextOut(). The guide says the default is 0. So I have to declare a size in pixels, e.g. WordWrap = 600 ? I have text running out of the window all the time. Dang, I'm so used to margins and paddings ... 8-)
jalih
Posts: 276
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: hey there (+ newbie questions)

Post by jalih »

Arminius wrote: This throws an error "Wrong operator for this type!" in the console. So it'll only take a string here? What did I do wrong?
Error message says it all, you are using "+" operator to concatenate strings (probably due to javascript background). You should be using ".." as concatenation operator.
Arminius
Posts: 10
Joined: Tue Sep 01, 2015 7:33 am

Re: hey there (+ newbie questions)

Post by Arminius »

Thanks for the quick reply, jalih - appreciate it! (For some reason after skipping through some examples I figured + would be used for concatenation within Hollywood as well ... :oops: )
zylesea
Posts: 227
Joined: Tue Feb 16, 2010 12:50 am
Location: Westfalen/Germany
Contact:

Re: hey there (+ newbie questions)

Post by zylesea »

It's always a bit difficult when you have some knowledge with other languages,I keep messing syntaxes from Matlab, C++ an Hollywood all the time...
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hey there (+ newbie questions)

Post by airsoftsoftwair »

Welcome, Arminius!

The "WordWrap" tag indeed accepts a value in pixels after which words will be wrapped. If you want to use margins, you can use SetMargins() but then you have to use Print().
Arminius
Posts: 10
Joined: Tue Sep 01, 2015 7:33 am

Re: hey there (+ newbie questions)

Post by Arminius »

zylesea - oh yes indeed. This thread is just a classic example 8-)

Andreas - thanks for taking the time and answering. It was helpful, although I can't seem to figure it out correctly. Please have a look:

Code: Select all

TextOut(#CENTER, #CENTER, "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua At vero eos et accusam et justo duo dolores et ea rebum", WordWrap = 500)
So I'd like my text to have a max width of 500 pixels. However, when testing the above code the text still spreads all over the screen. What's my mistake?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hey there (+ newbie questions)

Post by airsoftsoftwair »

So I'd like my text to have a max width of 500 pixels. However, when testing the above code the text still spreads all over the screen. What's my mistake?
"WordWrap" is a tag inside a table argument. Thus, you need to create a table first which can be done with the {} operators, i.e.

Code: Select all

TextOut(#CENTER, #CENTER, "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua At vero eos et accusam et justo duo dolores et ea rebum", {WordWrap = 500})
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: hey there (+ newbie questions)

Post by djrikki »

The correct way to declare a variable is by using the Global command at the top of your code, e.g.

Code: Select all

Global score
score = 15

Function myfunc()
Debugprint(score)
EndFunction
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
Post Reply