Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
52 user(s) are online (31 user(s) are browsing Forums)

Members: 3
Guests: 49

FirstNinja, derfs, VooDoo, more...

Headlines

 
  Register To Post
« 1 (2) 3 »

Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
;CreateClipRegion(1,#box,x,y,width,height)
;SetClipRegion(1) ; turns clipregion on
;FreeClipRegion(1) ; turns the region off

;Textout(0,0,"Hello there what is happening???")
;Textout(0,8,"I'll tell you what is happening!!!")
;Textout(0,16,"I've spent 5 hours trying to move this text by 8 pixels")
;Textout(0,24,"And it's not working out")
Print(0,0,"Hello there what is happening???")
Print(0,8,"I'll tell you what is happening!!!")
Print(0,16,"I've spent 5 hours trying to move this text by 8 pixels")
Print(0,24,"And it's not working out")
box(0,0,20,20,$00FF00)
CreateClipRegion(1,#box,0,0,60,24)
SetClipRegion(1)
BGPicToBrush(1,1)
ConvertToBrush(#BGPIC,1,1)
FreeClipRegion(1)


MoveBrush(1,#UseLayerPosition,#UseLayerPosition,400,260,4)

DisplayBrush(1,100,200)
Textout(100,200,"Done")
WaitLeftMouse()
***********************

Well, after 5+ hours (no, really, not kidding at all) I haven't found ANY combination of the above commands to MERELY take a segment of the screen and move it by 8 pixels.

In AMOS it was a piece of CAKE to do.

I am trying to grab a rectangle of 200 by 64 pixels and scroll it it 8 pixels up, so that I don't have to do 8 textout commands to reprint it all.

I read lots of the manual, and I couldn't find a way to do it. Couldn't grab a brush, well, I grabbed a pure black brush, of no use to me. I saw the thing about making 8 textout's into an object and moving it, but the problem with that is, there's always one new line being added to the group of 8 and one taken out, too much hasstle to do.

I didn't want to post here and look stupid, but I give up after 5 hours.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Not too shy to talk
Not too shy to talk


See User information
@Atheist

Well, I'm not sure if you are wanting to move the entire list of lines, or if you are wanting to scroll through a list of lines. The following code will allow you to do both. If you want to scroll through the list, just use the up and down arrow keys; if you want to move the entire list up and down, hold down the "m" key as you use the up and down arrows.

Quote:

EnableLayers()

Function p_MoveAllLines(DirectionVar)
If DirectionVar=1
YPos=YPos-LineHeight
Else
YPos=YPos+LineHeight
EndIf
DisplayBrushPart(1, 0, StartY, #CENTER, YPos, 100, LineHeight*5)
Undo(#BRUSHPART, 1, 2)
EndFunction

Function p_ScrollText(direction$)
If direction$="Up"
StartY=Max(StartY-LineHeight, 0)
ElseIf direction$="Down"
StartY=Min(StartY+LineHeight, LineHeight*5)
EndIf
DisplayBrushPart(1, 0, StartY, #CENTER, YPos, 100, LineHeight*5)
Undo(#BRUSHPART, 1, 2)
EndFunction

Function p_KeyCheck(msg)
If msg.key="UP"
If IsKeyDown("m")
p_MoveAllLines(1)
Else
p_ScrollText("Up")
EndIf
ElseIf msg.key="DOWN"
If IsKeyDown("m")
p_MoveAllLines(2)
Else
p_ScrollText("Down")
EndIf
EndIf
EndFunction

InstallEventHandler({OnKeyUp=p_KeyCheck})

SetFont("DejaVu Sans.font", 18)
SetFontStyle(#ANTIALIAS)
SetFontColor($0)
LineHeight=TextHeight("A")

CreateBrush(1, 100, LineHeight*10, #WHITE)
SelectBrush(1)
TextOut(5, 0, "Line One")
TextOut(5, 0+LineHeight, "Line Two")
TextOut(5, 0+LineHeight*2, "Line Three")
TextOut(5, 0+LineHeight*3, "Line Four")
TextOut(5, 0+LineHeight*4, "Line Five")
TextOut(5, 0+LineHeight*5, "Line Six")
TextOut(5, 0+LineHeight*6, "Line Seven")
TextOut(5, 0+LineHeight*7, "Line Eight")
TextOut(5, 0+LineHeight*8, "Line Nine")
TextOut(5, 0+LineHeight*9, "Line Ten")
EndSelect

StartY=0
YPos=#CENTER
DisplayBrushPart(1, 0, StartY, #CENTER, YPos, 100, LineHeight*5)

Repeat
WaitEvent
Forever

Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Not too shy to talk
Not too shy to talk


See User information
@Athiest

I just realized how hard that code might be to read, since the tabs at the beginning of the lines got lost. Let me know if you want me to e-mail you the code in an easier-to-read form.

Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Hi PEB,

I took a bit of a breather from programming, some things came up.

Thanks very much for the info.


New mysteries.
Quote:

NON=6 NAMESIZE=0
FOR X=0 TO NON
FOR Y=1 TO 10
NAME$=CHR(RND(26)+65)
FOR NL=1 TO X+2+NAMESIZE
NAME$=NAME$..CHR(RND(26)+97)
NEXT
NAME$[X+2][Y]=NAME$
NAME$=""
NEXT
SORT(NAME$[X+2][])
NEXT


I tried first this way, which is how it SHOULD work.
Quote:

FOR X=0 TO NON
FOR Y=1 TO 10
NAMET$=CHR(RND(26)+65)
FOR NL=1 TO X+2+NAMESIZE
NAMET$=NAMET$..CHR(RND(26)+97)
NEXT
NAMEAT$[X+1]=NAMET$
NAMET$=""
NEXT
SORT(NAMET$)
FOR X1=1 TO 10
NAME$[Y][X1]=NAMEAT$[X1]
NAME$=""
NEXT
NEXT


I can't believe that the above code doesn't work. So AMOS Professional also only sorts single dimensional arrays, but this won't even sort that, even though I used the command. I think that AMOS Pro would crash, if you sort a just sorted array, though .

Okay, I did more experimenting, and it gets ubsurd.
I tried Dimstr (after failing with Dim), and it still didn't work. So I made NAME$[x] all equal "", an empty string. And yet, when it hits the sort command, after all the random characters are assigned to NAME$[x}, it STILL complains that
"Table NAME$ not found."


Quote:

FOR X=0 TO NON
FOR Y=1 TO 10
NAMET$=CHR(RND(26)+65)
FOR NL=1 TO X+2+NAMESIZE
NAMET$=NAMET$..CHR(RND(26)+97)
NEXT
NAMEAT$[X+1]=({NAMET$})
NAMET$=""
NEXT
SORT(NAMEAT$)
FOR X1=1 TO 10
NAME$[Y][X1]=NAMEAT$[X1]
NAME$=""
NEXT
NEXT


This doesn't work either. It runs line "NAMEAT$[X+1]=({NAMET$})" but it doesn't work out later. I thought I built a table.


As far as I can tell, there's no Clear Screen command!

Hollywood has a lot of neat features, but not being able to scroll a portion of the screen, and the above, really is a draw back.

All these problems, I didn't realize just how hard it is to program. I have no clue how I could have managed to make a 5,000+ line program in AMOS Pro!

Although, I do stress, many abilities aren't available in AMOS as they are in HollyWood. Unfortunately some of them are hard to understand, well, I never could figure out AMAL.


* * * * *
Important things I've learned:

1. REMARK, the semi colon and
/* enter a comment which can go over multiple lines */
are the way to make comments/remarks

2. READ/DATA. There are no READ/DATA statements. You have to "read" by
SOME_THINGS$ = {"hat","coat","shirt","sock","keep going until you've entered everything"}

3. BOX, 2 commands are needed to make a box, and have the inside filled with color.

4. Finding out that it was possible to enter more than one command on a line wasn't easy to stumble across. In most basics, it's a COLON, but in HollyWood, just enter the next command you want to use beside the first one. HOWEVER, the "IF ....THEN" command doesn't work, QUITE the same as in AMOS. (The following applies, when not using EndIf.) If you have an "IF... THEN" in AMOS, all the commands are done after the colons, until a carriage return is gotton to. In HollyWood, the first command is executed if triggered by the "IF....THEN", but ALWAYS the next command and all others after that are triggered!!!

5. Cls 0. Doesn't seem to be a "clear screen" command. This is used alot, and there's no reference that it isn't available. Big mistake.


It wasn't easy coming across this info.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
I guess I have to write a routine to sort arrays manually, unless the author's around and can explain to me how to use the command himself.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Okay, I figured out what the problem was with sort, after literally 3 hours of testing!!! It's a quite long answer I'll give later.

Quote:

for X=1 to 26
locate (0,x*8)
A$=CHR(65+X)
textout (0,x*8,A$)
next
WaitLeftMouse()
end ()


Cannot at all fathom why the above, entire program, DOES NOT WORK (going insane, after sort command wouldn't work proprely.)
Here's the error message:
"Text format tag after square bracket not recognized! Line 4."


The textout command just won't print, and I've tried 5 variations.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Why the heck does changing line 3 to:

A$=CHR(RND(26)+65)

work!??!??!?!??!?!?!


AArrgrhgr!

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Not too shy to talk
Not too shy to talk


See User information
@Atheist

Quote:

Quote:

for X=1 to 26
locate (0,x*8)
A$=CHR(65+X)
textout (0,x*8,A$)
next
WaitLeftMouse()
end ()


Cannot at all fathom why the above, entire program, DOES NOT WORK


never used hollywood but your program has upper and lowercase variables for X

so you are always locating at 0,0 as lowercase x never gets incremented in the loop.

As you have already located why do you need to locate again using textout. try replacing the textout with print A$

Also in basic it used to be CHR$, but as i said i've never used hollywood.

A1XE, A1200T, X5020, CDTV, CD32 , A500+ A500
OS4.1b / OS3.2b
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
O.M.G!


I figured it out. It didn't like the value "X" because it could be a REAL number instead of an integer!!!! (Oh who knows, that's what I think, anyway.)

There isn't a suffix that defines integers, so I had to use hexadecimals, to figure that out!

Quote:

for X=$1 to $1A
A$=CHR(64+X)
TEXTOUT (0,X*$08,A$)
next
WaitLeftMouse()
end ()

Does what I expect it too, which is print the alphabet. Whew! Now only 100 more instructions times 3 hours each....

For instance, I was shown how to use the code below.
Quote:

Function PrintMyKey(msg)
Response$=UpperStr(msg.key)
RESPONSE=asc(Response$)
EndFunction

InstallEventHandler({OnKeyUp = PrintMyKey})

That's how to get input from the keyboard, but I still don't really understand how it works.

I saw how to receive the "return key was pressed" somewhere in the instructions but can't remember where, so I use the above code to see if ASC(Responce$) is equal to -38, then I know the RETURN/ENTER key was pressed.

In most (all?) other Basics it's CHR$ 13.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Hi Jurassicc,

I forgot to take out the Locate because I was using just print("some text") before that to try and get it to work and it doesn't have carriage returns.

Hollywood isn't case sensitive to variables. Thanks though.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Okay, I can't remember the finer details, and this took more than 3 hours. Closer to 7 but I figured out a problem with the sort command also.


Quote:

DIMSTR NAME$[18][11], NAMEAT$[14]

For X=1 to 10
For Y=1 to 3
NAMEAT$[X]=NAMEAT$[X]+ASC(RND(26)+64)
Next
Next
SORT (NAMEAT$)
For X=1 to 10
NAME$[3][X]=NAMEAT$[X]
Next
NAMEAT$="Cat"


Seems that alot was done, but the above program does pretty much nothing except for making the variable NAMEAT$ equal to "Cat".

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Hi All,

Does anyone know if there's a way to get the co-ordinates of where the cursor is? Also, is there a way to know the current Layer number?

I've been using variables all over the place to keep track for both.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Not too shy to talk
Not too shy to talk


See User information
@Atheist

If you want the number of layers currently on the display, use:
LayerNum=GetAttribute(#DISPLAY, 0, #ATTRLAYERS)

For the coordinates of the cursor use:
CursorX=GetAttribute(#DISPLAY, 0, #ATTRCURSORX)
CursorY=GetAttribute(#DISPLAY, 0, #ATTRCURSORY)

Be sure to check out the Hollywood documentation under GetAttribute() for more information.

Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Well, considering how awful the syntax structure of hollywood is I gave up using it, but now need a custom program for my own purposes, I've started coding again and misery QUICKLY ensued.

The SIMPLE ACT of writing one character over top another, and expecting the one below it to disappear, replaced by the new one is beyond my capability to achieve. Will someone help me in this quest?

(This is VERY VERY VERY EASY to do on other BASIC languages.)

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Currently I'm dealing with it by using the box command and printing a black box over text I want to get rid of before printing a new character. It's a pain determining where (x,y co-ordinates) and the pixel size of the box that is needed constantly to do this.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
Oh, one more difficulty.

I can't find the swap command, if it exists. I have to rotate through a third variable to switch the values of 2 variables.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Just popping in
Just popping in


See User information
@Atheist

Hello,
if you are using TextOut to print your character you know exactly whre you are rendering it because you have to specify the coordinates.
Hollywood have commands to determinate the width and the height of a given string (in pixel) so it's pretty easy to compute a box to overwrite the old character:
you have the coordinates and you have the box sizes.
Unfortunatly I'm at work and don't remember the command names used to exctract the width and the height of a string.

You can achieve the same result with many technics, for example:
- using layers
- using a brush
- re-rendering the old character with the bg color
- Using TextOut and a bg color (that will clear the previous character)
and so on...

The last method should be the easiest but only if you are using a fixed width font

Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Quite a regular
Quite a regular


See User information
I find Hollywood hard to use.

I want to open a file, grab 4 bytes, and turn it into a binary number.
Quote:

A=readstring(1,1)


So, after an embarrassing amount of time taking to figure that out, on to the next hurdle. Turning that into a binary string.
Quote:

A$=binstr(asc(A),#byte)

This command took a long time to find too.

Now, on to the next step, yikes:
Quote:

For x=1 to 10
A$=binstr(asc(A[x]),#byte)+A$
Next

Nope, doesn't work.

After an hour of trying different methods, I remembered that that's not how strings are concatenated.

But I dwelled on it a long time.

Anyhow, is there a way to read 4 bytes from a file directly into a 4 byte binary variable? And can "binstr(asc(A),#byte)" turn it into a 32 byte string?

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Just popping in
Just popping in


See User information
@Atheist

Nothing easier than that:

str$ = BinStr(ReadInt(1))

That's all, really.

Concerning your problem above (replacing a character or string with a different character or string), you should use the new Hollywood 4.0 command SetLayerStyle() which can do that with ease, e.g.

Print("a")
WaitLeftMouse
SetLayerStyle(1, {Text = "b"}) ; exchange "a" with "b"

Go to top
Re: Learning HollyWood (~Tutorial) Vol. 1
Just popping in
Just popping in


See User information
@Atheist

Quote:
Atheist wrote:
After an hour of trying different methods, I remembered that that's not how strings are concatenated.

But I dwelled on it a long time.


Dude, what are you doing! Are you even using the Hollywood reference material as your first point of call? You shouldn't be dwelling on things you don't know in the first place. Having experience with other programming languages just means you're better placed to know where in the documentation to look, nothing more.

Anyway, I wish you luck with your project, good to see you're committed.

Go to top

  Register To Post
« 1 (2) 3 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project