2020-03-25 03:46:40 (edited by amerikranian 2020-03-25 03:46:51)

So I have an interesting situation.
Observe this code:

        while 1:
            lucia.process_events()
            if self._handle_arrows():
                #logic...

#Here is handle_arrows function, or at least it's semi sudo code

    def _handle_arrows(self):
            if lucia.key_pressed(lucia.K_UP):
                #key logic
            if lucia.key_pressed(lucia.K_DOWN):
                #key logic
            else:
                return

The strange part about this code is that it works correctly only after an arrow key has been pressed at least once. Hell, it works fine even if I press some random key like tab or even switch out of the window.
My driver code does the following:
1. import lucia and the loop file
2. make lucia show a window
3. Run the loop code
Ideas? I am really confused, especially if I make the code break and rerun itself, it handles my key inputs just fine. It also works, like I said, after it loses one key event.

2020-03-25 10:47:57

hi again,
in your while loop, you are checking an if statement.
so, you should return True/False in your self._handle_arrows and do your logic after your if statement. or, you should implement your whole logic in your handle_arrows function.

2020-03-25 15:10:35

Did I forget to post the normal return statement? If so, I’m sorry. I have the return true at the bottom of the function.  Like I said, I don’t think it’s the issue with my code. It works just fine after losing one key press.

2020-03-25 15:37:10

so, what happens if you do your logic in your handle_arrows function?
I mean, calling that function in the loop and process everything there.

2020-03-25 19:45:42

I don’t necessarily want to do my handling in the main loop.  That is just dirty.  Basically I have my function return true whenever a value is modified. However, it does not even get to the modification stage. It is like the first key event gets thrown away. I added some sample print statements, and they don’t trigger the first time I press the key.

2020-03-26 00:07:54 (edited by amerikranian 2020-03-26 00:11:24)

Edit:
Kill me now. No, seriously.
So, guys, here's what not to do, LOL

import lucia
lucia.show_window("Test")
lucia.initialize()

The show_window function should probably complain that lucia was not initialized. That would have saved me so, so much trouble.

2020-03-26 11:53:06

Yeah. You need to initialize lucia before you do *anything* with it.

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988

2020-04-05 20:14:29

Does somebody know how to add reverb to the sound currently playing? For example city reverb or sth.

2020-04-05 23:06:52

Unless I’m significantly behind on what Lucia can do, you cannot, at least using base.

2020-04-06 09:52:10 (edited by kianoosh 2020-04-06 09:53:08)

No. You actually can apply effects on sounds using base. But i'm not sure how to do it I'm just aware of the possibility
You can't do it with lucia though you need to use sound_lib directly

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988

2020-04-06 12:29:19

If something like that is wanted, i'd recommend to think about allowing developers to build such functionalities into the backend code.

2020-04-06 16:06:51

hi,,
we might consider that as well.

2020-04-07 18:54:58

hi developers of lucia, please provide documentation more understandable anad small example in each function like in bgt documentation.
this frame work is better than bgt for me, butif you add more understandable documentation wood bee really cool.
hope you do it.
thankyou.

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2020-04-07 19:11:21

Please look at post 189 in this topic. You will find a link to some examples showing off the basic functionality there.

2020-04-07 19:46:20

Is this a bug or what?
I've packed my audio files into archive, and created the menu after loading a resource file and set it as default with set_global_resource_file,. I do not have a sounds in menu after this.

2020-04-08 09:24:29

Which one of the two menu classes are you using? Menu or Menu2?

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988

2020-04-08 10:42:36

I'm using menu

2020-04-08 11:25:40 (edited by ambro86 2020-04-08 13:26:26)

Hello everybody. I originally wrote to you asking for an example of a menu in Lucia. Searching on this topic I found an example already written, which however gave an error. I corrected it, and added a few things to make it more complete. It would be useful to insert these examples in Lucia, so that users are not confused as it still happens to me, not knowing how to use different modules.
I would ask. Is possible to have the wrap option, so when user scrolls menu items it returns to the first one?




import lucia, sys
from lucia.ui import menu2
lucia.initialize(audiobackend=lucia.AudioBackend.BASS)
#Window tytle
test = lucia.show_window("Menu")
#Now we insert the menu elements
MenuItems= [
    menu2.MenuItem("start", can_return=True),
    menu2.MenuItem("options", can_return=True),
    menu2.MenuItem("information", can_return=True),
    menu2.MenuItem("exit", can_return=True),
]
#Now let's list the sounds of the menu
menu1=menu2.Menu(items=MenuItems, clicksound="scroll1.wav", entersound="enter1.wav", edgesound="border1.wav", itempos=0, on_index_change=None)
#We make the menu come out only when the user presses exit.
while 1:
    result = menu1.run()
    if result[0]["name"] == "start":
        lucia.output.speak("Starting the game...")
    if result[0]["name"] == "information":
        lucia.output.speak("This is a test!")
    if result[0]["name"] == "options":
        lucia.output.speak("Here are the options!")
    if result[0]["name"] == "exit":
        lucia.output.speak("Thanks for playing!")
        lucia.quit()
        sys.exit()

2020-04-08 17:38:31 (edited by ambro86 2020-04-08 18:19:26)

Hi, sorry for the double post. I would like to ask these 2 things on the menu in Lucia:
1. How do I activate the wrapping option?
2. How do you insert a submenu?
I will write a code with 2 menues. It's the correct way?
Thanks.

import lucia, sys
from lucia.ui import menu2
lucia.initialize(audiobackend=lucia.AudioBackend.BASS)
#Window tytle
test = lucia.show_window("Menu")
#Now we insert the menu elements
menuOne= [
    menu2.MenuItem("start", can_return=True),
    menu2.MenuItem("options", can_return=True),
    menu2.MenuItem("information", can_return=True),
    menu2.MenuItem("exit", can_return=True),
]

menuTwo= [
    menu2.MenuItem("Set language", can_return=True),
    menu2.MenuItem("Set tts", can_return=True),
    menu2.MenuItem("Set audio settings", can_return=True),
    menu2.MenuItem("Go back", can_return=True),
]

#Now let's list the sounds of the menu
menu_1=menu2.Menu(items=menuOne, clicksound="scroll1.wav", entersound="enter1.wav", edgesound="border1.wav", itempos=0, on_index_change=None)
#We make the menu come out only when the user presses exit.
while 1:
    result = menu_1.run()
    if result[0]["name"] == "start":
        lucia.output.speak("Starting the game...")
    if result[0]["name"] == "information":
        lucia.output.speak("This is a test!")
    if result[0]["name"] == "options":
        lucia.output.speak("Here are the options!")
        menu_2=menu2.Menu(items=menuTwo)
        result = menu_2.run()
    if result[0]["name"] == "exit":
        lucia.output.speak("Thanks for playing!")
        lucia.quit()
        sys.exit()
    if result[0]["name"] == "Set language":
        lucia.output.speak("Choose your language")

2020-04-08 21:26:02

So this isn't a Lucia question persay, but more of a general programming question. It may seem like a silly one at first, but I'm genuinely curious about this.
Let's say I'm creating a clone of Zombie Arena in Python. Let's say I created a function tht allows the user to set up the Arena. It goes something like:
def Whipup_Arena(ZT, MX, MY, MZ, ):ZOMSPAWN
#The Player inputs all the parameters, the ombie types, the spawn rate/spawn time, the max x y and z.
arena_tile=random(tile1, tile 8):
  if(ZT==1):
spawn "wolf zombies"
if(zt==2):
spawn "Giant zombies"
else
spawn random
break

This isn't any code, i just tossed that together with no effort or thought behind it at all, so don't talk about the code for now. Anyway, let's say I added a way for the user to input all the stuff on line 1. And all the other stuff below all work properly. My question is, do I put this in the main.py file, or do I create a seperate module for it, and just import it. I can also add  more stuff to it, such as the player selecting the arena type, and adjjusting more parameters. Is it more efficient to just include all of that in the executable or modulise it? Will it make the game smaller? will it make a performance upgrade/downgrade if I do both? What would you do in this situation?
And my last request: Do you think you can edit that whipup_arena function for me please? Thanks to both! Cheers!

You ain't done nothin' if you ain't been cancelled
_____
I'm working on a playthrough series of the space 4X game Aurora4x. Find it here

2020-04-10 17:35:26

that is a vage question, since you can do what you want how ever you like, or should i say what works the best for you. if you feel like you want to add that hole function in a module, do it then, and just remember to import it. if you want to make it part of your main game, do it then. or if you want to put it in the main file, doesn't matter. as long as you call the right functions at the right time, i see nothing wrong with it...

best regards
never give up on what ever you are doing.

2020-04-11 01:51:43

@220, it really depends.
You could have a central game manager class and put your spawn functions in there
You could have a module responsible for spawning enemies.
You could wire it within your main_menu function (don't).
It's really up to you. Typically I air on the side of caution, putting as much into classes as I can. Doing so sometimes makes my code more independent, I.e, I could pull out enemy.py and open source that single file without releasing the entire project.

2020-04-11 21:40:23

Is any way to enable hrtf support with lucia and for example bass or openAL?

2020-04-11 21:49:29

So for the project I'm making, i'll be needing a couple functions. First, deviding posts by likes. Then, yule have the option to see your like count by entering in the percentage in which you want your like rate to increase by, or keep your current growth rate. I finishedd the first one, but the second one is a bit challenging. Do you guys have any tips or libraries that can help me out here?

You ain't done nothin' if you ain't been cancelled
_____
I'm working on a playthrough series of the space 4X game Aurora4x. Find it here

2020-04-11 22:27:06

I'm not sure what you are wanting here. Could you explain it in more detail? Feel free to provide sample input / output.