asdronin Posted May 11, 2019 Share Posted May 11, 2019 Hi all, As I have coded using variations of Basic language before (like Dark Basic Pro) I tend to think of some syntax things that should be the same always but of course its never everything the same. Then I wonder, how can I make a "if then" structure thats longer than one line? I have seen in all the sources I explored so far that if there is more than one command you just use ":" to add more things in same line, but isnt there a way to write that in several lines? I tend to prefer to have one command by line, I mean I see it better even if that makes the code longer, so I tried what I learned in the past and tried with "endif" or "end if" or just "end" and nothing appears to work, in help and tutorials I see always : is used in same line so maybe thats the only way we can make more than one thing happen inside a "if" block, could you please clarify this? Quote Link to comment Share on other sites More sharing options...
Mord Posted May 11, 2019 Share Posted May 11, 2019 Currently there's no way to have multi-line if-then-else structures. Most you can do is have the commands that need to be done separated with colons on the same line. sometimes I've done blocks of code intended for an if statement as it's own subroutine and just plugged that in. Not the most efficient but certainly more legible. Other times I've set up the IF statement so that it'll look for a skip condition. So if I wanted a bunch of commands to activate when A < 10, I'd instead write the if statement to be if A >= 10 then goto skiplabel. That way if it doesn't jump ahead to that label, it means the condition I really wanted is true, and I can safely execute a block of code between the if statement and the skiplabel. 2 Quote Link to comment Share on other sites More sharing options...
asdronin Posted May 12, 2019 Author Share Posted May 12, 2019 Thanks a lot Mord, so we have to deal with these techniques to do that, I think that should have been implemented in the tool other way but of course its a complex thing for the author. Additionally as I have verified "else" should always be in same line too (I got error saying "else" is not recognized word), I will follow your guidelines and hoepfully I manage to deal with this, I think it makes it harder to make a game but not impossible of course. By the way, a little off topic question, what games have you made? your avatar seems very familiar to me so maybe I played a game you made without knowing it was your creation, in any case your avatar is quite cool =) Quote Link to comment Share on other sites More sharing options...
Mord Posted May 12, 2019 Share Posted May 12, 2019 I tend to get distracted easily so I haven't actually completed a full game yet. On the 7800 I've mostly worked on Graze Suit Alpha although I've done a bunch of various demos, most of them involving attempts at scrolling in 7800basic. Use to tinker with the 2600 in assembly long before that but again never actually finished anything. 1 Quote Link to comment Share on other sites More sharing options...
asdronin Posted May 12, 2019 Author Share Posted May 12, 2019 Well its hard to make a game using these tools and language we have here, I looked into the Graze Suit Alpha video on youtube and it looks very cool fast action game, quite well done, I know how hard is to complete a game in any tool when you work on your own, requires lot of time and energy, Im sure you will complete one game soon and will be great, I found out your rpgtiledemo when I was searching for tile related games and its an awesome code really, keep making great stuff =) Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted May 12, 2019 Share Posted May 12, 2019 Other times I've set up the IF statement so that it'll look for a skip condition. So if I wanted a bunch of commands to activate when A < 10, I'd instead write the if statement to be if A >= 10 then goto skiplabel. That way if it doesn't jump ahead to that label, it means the condition I really wanted is true, and I can safely execute a block of code between the if statement and the skiplabel. Speaking of that, although the batari Basic page is for Atari 2600 programming, it has a section that talks about the same thing: randomterrain.com/atari-2600-memories-batari-basic-commands.html#endif 2 Quote Link to comment Share on other sites More sharing options...
asdronin Posted May 13, 2019 Author Share Posted May 13, 2019 Thanks a lot for showing this Random Terrain, I think as said I will be using these techniques to deal with the "if" structure you have implemented =), certainly Im part of the endif addicts group haha so these techniques work fine for me =) 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.