Re: classes in classes in bgt, can i do that?

2019-09-05 Thread AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

Hi there,@1: what you're trying to do is called a nested class, and it seems like BGT doesn't support it. Other languages do have support for such nesting, however it's used only in special cases. For example, Android sdk uses R as a base class for managing resources, where nested classes like string store various resource types. The benefit is, that you can access any string like:R.string.credentialsMessageto get its id and display it. Although I personally don't get why r.string.x contains just ids and not actual strings, when the parsing is obviously already done, however that isn't only thing in Java, which doesn't make a sense. This approach is not very popular in general, probably because of the mess made in a class by nested code. Thus if you want to make two classes connected with each other, it would be better to give them to separate module.A module then represents a functionality, which is carried then by its classes. For example bgt_kit for Python has modules Audio, Input, Output, Initialization and Various, where for example Input module has public classes Window, KeyboardShortcut and WindowHandler. They are all in one module, because all of them covers user input in some way.Audio module for example has classes Sound and HrtfSound, where both plays sound using libaudioverse in bgt style. Audiocaching is done wia statical content, however if I wanted to have a class for this, I would make an _AudioStorage class, where the _ symbol means, that it's a module private class. What makes sense because I don't want the audio caching functionalities to be used anywhere outside the module, so making the class private will ensure module's encapsulation and make potential user more aware of what he / she is expected to use.So using modules, you can make a nice encapsulated structure, where everything is on right place and doesn't overlap with other code in a ugly way.And what is the best? It's that Bgt doesn't support modules, so you are out of luck again. I've been writing this, because when you'll expand to other languages, what you most likely will, if coding makes you happy, you will face this structuring of code and it'll be thus useful to know what's going on. in Python they're called modules, in C# namespaces, in Java & Kotlin Packages, in Rust crates, in Dart libraries, but it's generally the same principle.Probably the best you can do to separate things to modules in Bgt is to use the _ symbol before class name like in Python and hope that others will get what it means. Regarding to files structure, you can use either file = module model like Python, or make a folder for each module, where file = class and there will be one additional file called init.bgt for example, which could get included from the main program and its job will be to include all classes in the module, so they can be used.These are of course just ideas, Bgt has no standardized way how to do this, so you can use whatever you want. Best regardsRastislav

URL: https://forum.audiogames.net/post/459866/#p459866




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: classes in classes in bgt, can i do that?

2019-09-04 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

@7 woops, @5 posted litterally as I was posting @6 lmfao.

URL: https://forum.audiogames.net/post/459638/#p459638




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: classes in classes in bgt, can i do that?

2019-09-04 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

Well, judging from his answer (#5), it very well seems like it did answer his question . But he can specify his question more clearly for sure if they're still things open.Best Regards.Hijacker

URL: https://forum.audiogames.net/post/459632/#p459632




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: classes in classes in bgt, can i do that?

2019-09-04 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

@4 I'm not sure that's what he asking.@3 can you please explain it for me more?I think he's asking for something that can randomly generate 1 to a random amount of questions and or answers based on the answers and or questions given?

URL: https://forum.audiogames.net/post/459576/#p459576




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: classes in classes in bgt, can i do that?

2019-09-04 Thread AudioGames . net Forum — Developers room : simter via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

Thanks, figured that out also a few minutes after posting my last post.

URL: https://forum.audiogames.net/post/459575/#p459575




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: classes in classes in bgt, can i do that?

2019-09-04 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

Well, that is surely possible, you just don't have to put the interaction class into the parent class:class interaction
{
  ...
}

class bot
{
  interaction@[] interactions;
}That works fine. Your relation works just fine however, you just need to change it a bit. Just decide to go for an array of answers to one question, since an array can also contain only one entry. And if you want multiple questions to have the same answer, just add this answer to those multiple questions. If you really go for a class system, its just as easy as adding the same handle into those corresponding arrays.Best Regards.Hijacker

URL: https://forum.audiogames.net/post/459533/#p459533




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: classes in classes in bgt, can i do that?

2019-09-03 Thread AudioGames . net Forum — Developers room : simter via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

Cause what i wanna do is something like the following. You have a little bot thing. It has several different answers to several questions. You can also put multi answers to one question that are then used randomly or multiple questions to 1 answer. That's not possible in a simple aray. Currently i have inside the bot class some code like this:interaction@[]interactions(0);class interaction{string[] questions, answers;}that's not possible with an aray, adleast if i wanted to add more then 1 question.

URL: https://forum.audiogames.net/post/459461/#p459461




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: classes in classes in bgt, can i do that?

2019-09-03 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: classes in classes in bgt, can i do that?

Nope, you cannot add classes in classes in BGT. But why don't you add those arrays directly inside the parent class, instead of creating a child class?Best Regards.Hijacker

URL: https://forum.audiogames.net/post/459459/#p459459




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


classes in classes in bgt, can i do that?

2019-09-03 Thread AudioGames . net Forum — Developers room : simter via Audiogames-reflector


  


classes in classes in bgt, can i do that?

Hi. Today i wanted to write a program for private tests that was a bit complex inside. So i created a class and in that class i created another class. How ever, now i get the error that it Expected method or property. Is there a way to make a subclass in another class? I mean, this class is jjust there to hold 2 arrays, but enum doesn#t work cause first of all these should be modifyable and second it are string arays.

URL: https://forum.audiogames.net/post/459437/#p459437




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector