so in bgt it doesn't know the difference between 0 and 1 when saying: array.length. And when I try: if(array_is_empty, but that seems to have no effect. What is the best way of it knowing the different between 0 and 1 items?
Pages 1
You are not logged in. Please login or register.
AudioGames.net Forum → Developers room → 0 vs. 1 with bgt arrays
so in bgt it doesn't know the difference between 0 and 1 when saying: array.length. And when I try: if(array_is_empty, but that seems to have no effect. What is the best way of it knowing the different between 0 and 1 items?
In any programming language, an array is empty if it has 0 items. 1 item, even if it is an array, constitutes a non-empty array. Is there something that you are testing that is not giving the result you expect? If so, please provide a short snippet that illustrates the question.
Thanks!
Kind regards,
Philip Bennefall
Couldn't you just do
array = {"GoT", "Big Bang Theory", "Grey's Anatomy", "The Ranch", "LivePD"};
if (array)
{
//do stuff
}
else
{
//other stuff
}
The inverse would be if (!array). I've done that type of thing in other langs and it worked fine, syntactically matching the other lang's structure of course.
If the OP wants an initializer list, the syntax is:
int[] my_list={1, 2, 3};
Kind regards,
Philip Bennefall
@7 I think it's clear that BGT will not get updates. I think that if you want updates to BGT< you'll have to consult with Philip. I'm not sure of the details, but I guess if you pay him it may be possible for him to make your updates, keyword being may as I am not Philip so can't say. LOL
I have had several requests from people who want to buy the source code for BGT, but I have turned them down for various reasons which I shall not expand upon here. At this time I don't have any planned updates because I have neither enough time nor enough interest to dive back into it. As I stated in another topic a while back, I recommend people look into other programming languages. BGT was good for what I intended it to do about 10 years ago, but it is not particularly relevant today. If you want to make Windows games and are aware of what the engine can and cannot do, by all means use it. But I personally think it is time to move on and expand the audio games landscape far beyond the feature set of BGT.
Kind regards,
Philip Bennefall
I recommend trying JS or python, because it is clear that BGT will have no updates. Well, it's quite clear now rooofl
So @1, are you confused by the 0 based indexing in arrays? I have never in all my time using BGT seen the length method of an array fail to do what it is supposed to do. I'm almost certain it can not be confused with 0 and 1 items. If array.length returns 0, there are 0 items. If array.length returns 1, there is 1 item. If it returns 0 and you try accessing array[0], it will crash because that element doesn't exist. If it returns 1 and you try accessing array[1], it will also crash because it thinks you are trying to access the second element in the array. Arrays are indexed starting at 0, so if array.length returns 1, the proper way to access that element is by accessing array[0]. Hopefully this helps.
@13 I already knew. I think I’m just an idiot for not trying if(array.length==0 or 1). I seriously think I thought I did that but haven’t. Maybe I thought but didn’t
AudioGames.net Forum → Developers room → 0 vs. 1 with bgt arrays
Generated in 0.046 seconds (25% PHP - 75% DB) with 10 queries