BBC BASIC for Windows
« *DISPLAY Command »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: *DISPLAY Command  (Read 351 times)
basscott
New Member
Image


member is offline

Avatar




PM


Posts: 5
xx *DISPLAY Command
« Thread started on: Oct 9th, 2015, 07:42am »

Dependent upon the value of a variable (see below) I am trying to display 1 of 25 BMP files (named 1.BMP to 25.BMP) and can do it fairly easily with 25 lines but would like to try to do it in less lines, as follows: -

A%=G(25,1): *DISPLAY A% 240,350

It seems that the *DISPLAY command will not take a variable such as A%.

Is there any way that I can do this without having to name each file over 25 lines of code ?
User IP Logged

sbracken
New Member
Image


member is offline

Avatar




PM


Posts: 19
xx Re: *DISPLAY Command
« Reply #1 on: Oct 9th, 2015, 09:55am »

You need to use the OSCLI command to pass variables to any star command, which is documented in the supplied help file, or on line here:

http://bbcbasic.co.uk/bbcwin/manual/bbcwin8.html#accessing

You also need to convert A% to a string, as BB4W will not do this for you and will throw a "Type mismatch" error. So, for your example, you need something like:

Code:
 OSCLI "DISPLAY """+STR$(A%)+".bmp"+""" 240,350"
 


However, usless there is a pressing for it elsewhere in your program, you can get rid of A% entirely and use the original array in the OSCLI command:

Code:
 OSCLI "DISPLAY """+STR$(G(25,1))+".bmp"+""" 240,350"
 


Note the use of multiple quote marks to "escape" the quotes needed for the name supplied to the DISPLAY command.

Simon
User IP Logged

basscott
New Member
Image


member is offline

Avatar




PM


Posts: 5
xx Re: *DISPLAY Command
« Reply #2 on: Oct 9th, 2015, 3:05pm »

Excellent - works perfectly and just what I wanted.

That's another fact learned smiley

Thanks a lot for helping.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls