English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 28 January 2018, 00:29   #101
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,335
That will happen when the PortSigBit() function is missing - the compiler thinks it's an array instead. AmiBlitz includes all the main libraries by default, but the basic installation of Blitz 2 only includes the core libraries. PortSigBit() is in the RIMiscLib, which is included as an optional extra IIRC. You'll need to add it to your installation, or else install the Ultimate Blitz CD, which should include all those libraries from the start.
Daedalus is offline  
Old 28 January 2018, 09:55   #102
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Thanks for clarification however I did install BSS after one of your previous posts.
Now I rechecked for RIMiscLib and found it in:
- blitzLibs: otherLibs/
- blitzLibs: RILIBS/

It was missing from: blitzLibs:USERLIBS, so I put it there too.

Anyway I still have the same error msg
peceha is online now  
Old 28 January 2018, 12:27   #103
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,335
Hmmmm, did you use the updated installer from Aminet? The libraries in Blitz need to be "built" into a libraries file before they can be used. What size is your Deflibs file? Mine is 274,284 bytes. If yours is much smaller than that, it would appear that you're still using the default version.
Daedalus is offline  
Old 28 January 2018, 13:03   #104
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
deflib size: 373,212 - I think I'm going to remove everything and just install it again.

I'm still experiencing these graphics problems that I mentioned before - so I think it might be related too.

Below is a better example.
I just strated the program 3 times in a row and everytime these "glitches" were in different places (some of them I marked in red circles)
Window no.4 shows different problem: afetr using WCLS the top line (just under the bar) remains (window has a GIMMEZEROZERO flag)



I hope all will be fixed after reinstall.

Thanks.
peceha is online now  
Old 28 January 2018, 14:08   #105
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
There are a lot of interesting questions in this thread but all in the same pile is very difficult to search. Please, why not a thread each question?
tolkien is offline  
Old 28 January 2018, 18:19   #106
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
I think, you are right - especially that part about incorrect installation doesn't fit in here.
I'm going to start a new thread.

Thanks.
peceha is online now  
Old 29 January 2018, 09:58   #107
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,335
Hmmm, okay, the glitches are strange, but I think it might be something like a mismatch of bit depths. If you blit to a bitmap that has more bitplanes than your shape, the extra bitplanes will be filled with garbage, causing glitches in certain colours. There are ways around it, but the simplest is to make sure everything is the same depth.
Daedalus is offline  
Old 29 January 2018, 10:30   #108
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Yep, I also vote for separate threads!
MickGyver is offline  
Old 20 February 2018, 17:46   #109
Jackoland
Registered User
 
Join Date: Jun 2014
Location: Leeds
Posts: 174
Sorry very basic question. When would you use arrays and can someone give me example of an array.

Cheers
Jackoland is offline  
Old 21 February 2018, 10:25   #110
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,335
Arrays are useful where it makes sense to have multiples of the same variable, each of which you can access individually. One example is player health in a game. If it's a single player game, you might just need one health variable, called "Health". If it's a multiplayer game, you could use two separate variables, e.g. P1Health and P2Health, but it might be more useful to create an array instead. This will let you access the healths based on an index, so instead it would look like Health(1) and Health(2). Lives, for example, can follow the same principle in their own array. The advantage of this is that you can use the same code for both players, typically in a loop:

Code:
For Current_Player = 1 To 2
  ; Do all your moving etc. for the first player

  If Player_Hurt
    Health(Current_Player) - 10

  ; Now check if the player is dead, take away a life and resurrect them if so
    If Health(Current_Player) <= 0
      Lives(Current_Player) - 1
      Health(Current_Player) = 100
    End If
  End If
Next Current_Player
To use an array, it must first be defined. This is done using the Dim statement, and defines how many elements to create in the array. So to set up the two arrays above for 2 players:

Code:
Dim Health(2), Lives(2)
That's about it really. There are other types of arrays, but that's the most basic arrangement. There are also ways to combine multiple attributes in a single variable that are useful, then you can do things like

Code:
NPrint Player(Current_Player)\health
NPrint Player(Current_Player)\lives
NPrint Player(Current_Player)\score
So you have just one array with multiple entries for different properties. They're called "Newtypes", but get used to simple arrays first
Daedalus is offline  
Old 21 February 2018, 22:57   #111
Jackoland
Registered User
 
Join Date: Jun 2014
Location: Leeds
Posts: 174
Thank you. I understand a bit better now.
Jackoland is offline  
Old 31 March 2018, 16:15   #112
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Hi again.
That is going to be basic question.

Let's say I have a macro in my code.
Let's say there is a syntax error in my macro.
Let's say my macro is quite big and complicated.

How do I know where the error exactly is?
After pressing "Compile and run" I get a msg: "SYNTAX ERROR" and the blitz is pointing to the line where I call my macro from and not to the problematic line in the macro.

Thanks.

------
It was not easy but I found it:
Was "\" instead of "/"

Last edited by peceha; 31 March 2018 at 20:03.
peceha is online now  
Old 01 May 2018, 23:38   #113
E-Penguin
Banana
 
E-Penguin's Avatar
 
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,214
Corruption in loaded BitMap

So, my remake of Asteroids breaks cover. Or, at least a littie bit. The concept is "asteroids using pictures of actual asteroids from spacecraft I have flown". I'm pushing definitions a bit here and am including comets. Anyway, I can get 67P/Churyumov-Gerasimenko bouncing merrily around the screen well enough. I wanted to have some nice backdrops of a similar theme so wanted to have Mars in the background. I created the image in PPaint, saved it as ILBM, but get this weird banding. The colours are all wrong, I suspect that's to do with palettes, which I haven't yet entirely worked out.

Do I need to save the background in any sort of special format? It looks almost interlaced.

Screengrab from winuae (standard A1200 conf) and source files attached.
Attached Thumbnails
Click image for larger version

Name:	Untitled.png
Views:	93
Size:	63.9 KB
ID:	58038  
Attached Files
File Type: rar Test.rar (22.0 KB, 49 views)
E-Penguin is offline  
Old 02 May 2018, 08:16   #114
clenched
Registered User
 
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
( PPaint or DPaint ) If the stencil is turned off and picture saved back Mars looks OK in Blitz. PaintShopPro, IrfanView, Maptapper (win) or MultiView, PPShow (ami) didn't show the original correctly either.

Last edited by clenched; 02 May 2018 at 17:44. Reason: add programs that didn't display picture correctly
clenched is offline  
Old 02 May 2018, 11:12   #115
E-Penguin
Banana
 
E-Penguin's Avatar
 
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,214
Thanks, I'll give it a go without stencils, once I've worked out what that is
E-Penguin is offline  
Old 08 June 2018, 02:56   #116
Cobe
Registered User
 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 41
Posts: 999
Has anyone succeeded in cycling colors of background bitmap when using ocs dualplayfield with displaylibrary?
No matter what I do I always get only colors in front to unintentionally cycle...
Cobe is offline  
Old 10 June 2018, 02:34   #117
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
Is there any command to leave a loop? (Either a While or a For) ?
Shatterhand is offline  
Old 10 June 2018, 07:46   #118
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Quote:
Originally Posted by Shatterhand View Post
Is there any command to leave a loop? (Either a While or a For) ?
I haven't found one, been looking for the same. Maybe you can use a Goto to jump to a label just outside of the loop? I have no idea if that would "break" anything. Somebody more of an expert on BB will probably answer.
MickGyver is offline  
Old 10 June 2018, 08:09   #119
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
Quote:
Originally Posted by MickGyver View Post
I haven't found one, been looking for the same. Maybe you can use a Goto to jump to a label just outside of the loop? I have no idea if that would "break" anything. Somebody more of an expert on BB will probably answer.
I believe with the FOR...NEXT you can just change the value of the looping variable so its condition won't be true again. Didn't try it out, but it should work.

For the while, I end up using another variable on the While condition, and change it when I want to leave the loop.. but this adds a new check every iteration of the loop. There should be some smarter way to do it.


NEW QUESTION:

Is there some way to create an "array of subroutines"?

Like, I have 20 subroutines (each one under a different label), and I want to execute one depending upon the value of a variable.

So instead of using a
Code:
Select AAA

case 0
  gosub routine0
case 1
  gosub routine1
...
case 19
  gosub routine19

End Select
which will be slow as hell (and actually smarter doing somekind of tree structure)

Could I just use something like

Code:
GOSUB routine(A)
Any ideas if its possible to implement something like this?
Shatterhand is offline  
Old 10 June 2018, 08:52   #120
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Quote:
Originally Posted by Shatterhand View Post
I believe with the FOR...NEXT you can just change the value of the looping variable so its condition won't be true again. Didn't try it out, but it should work.

For the while, I end up using another variable on the While condition, and change it when I want to leave the loop.. but this adds a new check every iteration of the loop. There should be some smarter way to do it.
What you are suggesting should work but the whole "step" will be executed before exiting the loop.

The user guide for BB2.1 suggests Goto but that Pop must be used for some loops:

Code:
Pop Gosub | For | Select | If | While | Repeat
Sometimes, it may be necessary to exit from a particular type of program loop
in order to transfer program flow to a different part of the program. Pop must
be included before the Goto which transfers program flow out from the inside
of the loop. Actually, Pop is only necessary to prematurely terminate Gosubs,
Fors and Selects. If, While and Repeat have been included for completeness but
are not necessary.
MickGyver is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitz basic 2 Help Havie Coders. Blitz Basic 30 08 September 2013 09:15
blitz basic petza request.Apps 11 08 April 2007 01:49
Blitz Basic 2 anyone? jobro request.Apps 12 28 November 2005 18:15
Blitz Basic StopCD32 Tony Landais Coders. General 2 08 May 2003 22:51
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 08:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:52.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.44041 seconds with 14 queries