English Amiga Board


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

 
 
Thread Tools
Old 14 January 2018, 10:29   #61
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 41
Posts: 17
Thanks!
Now it is not magic anymore
peceha is offline  
AdSense AdSense  
Old 16 January 2018, 19:38   #62
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 41
Posts: 17
Hello
Two basic questions:

1. is it possible to pass a list to a function as an argument?

2. is it possible to declare a list within a function?
When I try to do this inside the function i get error "ARRAY IS NOT A LIST":
Code:
NEWTYPE.myType
 a.b
 b
 c
End NEWTYPE
Dim List lista.myType(100)
If AddItem(lista()) Then lista()\a=1 ;here the error shows up
When i move NEWTYPE...End NEWTYPE and DIM outside the function everything is working fine

Thanks.


EDIT
3.What is going on here:
Code:
NEWTYPE.bspArea
 c.b
 r
 w
 h
End NEWTYPE

Statement test{c,r,w,h}
 nPrint c," ",r," ",w," ",h
 ;DEFTYPE.bspArea panel    ;<- when i uncomment this line strange results are showing
End Statement

test{0,0,10,10}
MouseWait
End
without DEFTYPE: 0 0 10 10
with DEFTYPE: 0 0 10.9997 10

Last edited by peceha; 16 January 2018 at 22:39.
peceha is offline  
Old 16 January 2018, 23:54   #63
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,376
1: Not that I know of. You can use the Shared keyword to allow the procedure to access the same list as the main program. Newtypes can be passed as a pointer, but I don't think lists can be assigned to pointers so I don't think passing a list is possible. Maybe someone else knows a way though?

2: No, only indexed arrays can be declared within a function. As before however, you can use a global list with the Shared keyword, so long as you remember to clear it each time and don't do any recursion.

3: Hmmm, looks like a bug. What version of Blitz are you using? I vaguely remember in the AmiBlitz changenotes that there was a fix for some bug in parameter passing that you may have stumbled upon. It looks like a mismatch of types that's not getting picked up by the compiler / debugger. I would suggest always declaring types for parameters like that, and that should avoid the problem:

Statement test{c.b, r.b, w.b, h.b}
Daedalus is offline  
Old 17 January 2018, 00:07   #64
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 41
Posts: 17
ad.3
Im using BB2 release 2.1, TED v2.24

When I replace Statement test{c,r,w,h,} with:
..{c.b, r.b, w.b, h.b} then i have 0 0 -8 10
..{c.w, r.w, w.w, h.w} then i have 0 0 -12 10
..{c.l, r.l, w.l, h.l} then i have 0 0 65516 10
peceha is offline  
Old 17 January 2018, 10:44   #65
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,376
Hmmm, that's very weird. There appears to be an extra byte or something assigned to the 3rd parameter. I would use a later version of Blitz 2 fro a start, see if that fixes the problem. The Ultimate Blitz Basic CD has a later version, and other updates are available from Blitz-2000.co.uk.
Daedalus is offline  
Old 17 January 2018, 10:54   #66
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 41
Posts: 17
Thanks for help.
You were right about a bug:
Quote:
3rd parameter bugfix" Fixes an important and serious bug in the passing of the third parameter to functions.
I'll try to update everything now.

Thank you.
peceha is offline  
Old 19 January 2018, 00:10   #67
E-Penguin
Banana

 
Join Date: Jul 2016
Location: Darmstadt
Posts: 417
If there an equivalent of If ... Else If ... Else?

I've tried "Else If" "Elseif" and "Elsif" but it doesn't like any of them. There must be a way, surely?
E-Penguin is offline  
Old 19 January 2018, 12:42   #68
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 41
Posts: 17
Hi,
how does QUALIFIER work?

I typed the script from manual but it doesnt work for me:
Code:
...
While (Qualifier AND $8)=0
...
Wend
...
what key press quits the loop?
peceha is offline  
Old 19 January 2018, 22:18   #69
TurboCrash
Registered User

 
Join Date: Dec 2015
Location: Lisbon/Portugal
Posts: 21
Quote:
Originally Posted by E-Penguin View Post
If there an equivalent of If ... Else If ... Else?

I've tried "Else If" "Elseif" and "Elsif" but it doesn't like any of them. There must be a way, surely?
If

Else

EndIf

I recommend having a PDF with OCR scan of the manual, it's available online.
TurboCrash is offline  
Old 19 January 2018, 22:33   #70
E-Penguin
Banana

 
Join Date: Jul 2016
Location: Darmstadt
Posts: 417
Also; how does one get dual playfields to work? I just can't seem to get the background to display. I guess it's a palette issue, but I'm not sure which colour to set.

To make matters more complicated (because an easy life isn't for me), I want to have an 8-coloured background and a 4-coloured foreground. The hardware should support this, but does Blitz? I'd rather not have 8-colours in my foreground as I want to minimize the amount of blitting.

http://amigadev.elowar.com/read/ADCD.../node0079.html

Is the secret to have 8 bitplanes in both fields but only blit the planes I actually want, using something like BitPlanesBitMap?

I realise that I may be running before I can walk... but I thought it should be relatively straightforward to have one box moving in front of the other...
E-Penguin is offline  
Old 19 January 2018, 22:40   #71
E-Penguin
Banana

 
Join Date: Jul 2016
Location: Darmstadt
Posts: 417
Quote:
Originally Posted by TurboCrash View Post
If

Else

EndIf

I recommend having a PDF with OCR scan of the manual, it's available online.
Thanks. I meant like (if it was java)

Code:
if (test1){
  do_thing_1
}
else if (test2){
  do_thing_2
}
else{
 do_default_thing
}
If test1=true then I needn't bother testing test2, which would save doing a comparison.

A concrete exampe; I'm bouncing a box around a screen, and I want to bounce it off the edges of the screen. So, I test for the 4 extremities. However, if the box hits one edge I needn't bother testing the opposite one, as it can't possibly hit both.

Last edited by E-Penguin; 19 January 2018 at 22:46.
E-Penguin is offline  
Old Yesterday, 08:52   #72
witchmaster
Registered User

witchmaster's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 165
Quote:
Originally Posted by E-Penguin View Post
If there an equivalent of If ... Else If ... Else?

I've tried "Else If" "Elseif" and "Elsif" but it doesn't like any of them. There must be a way, surely?
As far as I know, there is no ElseIf. You should be able to do this:
Code:
If
  ...
Else
  If
    ...
  EndIf
EndIf
witchmaster is offline  
Old Yesterday, 13:26   #73
TurboCrash
Registered User

 
Join Date: Dec 2015
Location: Lisbon/Portugal
Posts: 21
Regarding the playfield and bitplanes take a look at page 80
https://archive.org/details/blitz-basic-2-user-guide

I think this applies to slices but the last version of Blitz 2.1 can do more with AGA and copperlist if I'm not mistaken, because I'm noob too
TurboCrash is offline  
AdSense AdSense  
 


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 10:15
blitz basic petza request.Apps 11 08 April 2007 02:49
Blitz Basic 2 anyone? jobro request.Apps 12 28 November 2005 19:15
Blitz Basic StopCD32 Tony Landais Coders. General 2 08 May 2003 23:51
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 09: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 14:59.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Page generated in 0.14565 seconds with 13 queries