bitworks's Forum Posts

  • Yeah, upon further investigation and a visit to Microsoft webpage it seems that it's impossible - the newer version of pad input on Windows Vista and newer is not DirectX but rather something called XInput. In theory it's less clunky and more cross-platform friendly (think XBox -> PC ports and vice versa). But that also means that some features are disabled for DirectX input, vibrations / FF being one.

    Fun fact: the XBox360Controller plugin for CC works well, I was able to use ForceFeedback (quite simple, but still) with that. So InputSystem for all the input stuff, XBox360Controller plugin for vibrating the pad, Python script for fast controller mapping and voila! Works like a charm. :)

  • Alright, it seems to work just fine with an XBox Controller, but... Is the ForceFeedback really supported? It shows N/A on InputSystem.GetJoystickFFCapabilities() and does not vibrate at all when ordered to. Hm. Any experience with that?

    Also, I'm using it on a Win7 system, and I've heard that there's some XInput / DirectInput hassle. Don't really know what to make of it.

  • TunaUppercut, I'm overJOYed to hear that! :) I thought using DirectX to retrieve the input allows this, but I had to be sure. Thank you for the info!

  • sglorz, the plugin is fantastic and provides the dev with plenty of useful options - great thanks for that! By the way, I have a small question - does it support a Xbox 360 controller? I'm considering buying one and am just curious if I could easily integrate it with my project via the Input System.

  • Thank you for a fast response! Oh... so it makes me wonder why have those Message Box options in the Python script editor at all. I know it's kind of an oddity, but it managed to confuse me and made me thing that it is functional, wasting a day of my life. Anyway, thanks again!

  • Hi. What object are you trying to spawn? When? What's else in the project? Some other details would be really helpful...

  • Hi!

    I'm trying to use the MessageBox object in CC and evaluate some actions in Python. I've got it to display the message, but it fails to understand what option am I picking, no distinction between Yes / No etc. Any way to better handle this?

    Here's a bit of code:

    msgBox.SetButtons(2)
    msgBox.SetIcon(3)
    msgBox.MessageBox("Hey!", "Close this stuff?")
    if msgBox.OnYes():
        System.Close()
    else:
        sometext.Text = "You didn't close."

    Please help my guys, the frustration is killing me and my project. :P Any tips much appreciated.

  • I'm trying to use XAudio2 in a Python script, mainly playing sounds / resources. My question is: how do I do this? Do I have to

    XAudio2.AutoplayResource(System.AppPath+"menu_move_01.wav",0)

    Every time I try to play a sound using a Python script it gives me an error:

    XAudio2: Failed to load file from disk. Check the filename exists and that the file is of a supported format. (0x80004005)

    That resource / file is a simple .WAV file, playing well from an event when called, but not from script. This would help me greatly if I could invoke it using Python, so any help appreciated, as always!

  • I have a curious question. How does the Mouse&Keyboard work with Python? I'm trying to capture some of the input keys and stumbled upon the MouseKeyboard.OnAnyKey() option, which might be useful for this. There's no MouseKeyboard.LastKeyPressed, so I'm going the other way around. Let's say I have this:

    MouseKeyboard.OnAnyKey()

    How am I supposed to use this? Is it something like:

    MouseKeyboard.OnAnyKey():
        myText.SetText("key pressed!")

    or

    MouseKeyboard.OnAnyKey(dostuff())
    
    def dostuff():
        myText.SetText("key pressed!")

    Any help appreciated, I'll try to experiment with this on my own in the meantime. :)

    Edit: I was able to make it somehow work, by using

    if MouseKeyboard.OnAnyKey():
         if MouseKeyboard.OnKey(get.key("key_config","select")):
              debug.SetText("select pressed")
         elif MouseKeyboard.OnKey(get.key("key_config","cancel")):
              debug.SetText("cancel pressed")

    But it seems to work only with VK_ keys, according to this post: scirra.com/forum/construct-keyboard-in-python_topic39918.html

    That is: I can test for space button, or the Numpad buttons, but no A, S, D keys and so on. Any way to do this?

    Thanks in advance!

    Edit#2: Well, it seems a light fever helped me find the solution. The keys mentioned in that mapping thread are 0-indexed, so that I had to subtract 1 from every each value I wanted to map. Now it works like a charm, I think.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well, this seems to be what I'm looking for, thank you! I'm creating instances in a loop, one per loop, so accessing that instance in that loop should do just fine, I suppose. Also, storing a dictionary or a list of SOL items created that way in a Hash Table sounds very promising! Great idea.

  • Hi!

    Right now I'm working on some dynamic menus for a miniRPG project. I wanted to create a menu with Python by using a function with a parameters, like this:

    display("Title","Content",["OK,"CANCEL"])

    and then

    def display(title,content,options):
        ...
        # CREATION OF NEW OBJECTS
              for items in options:
                  ?System.CreateByName("POPUP_OPTION_BG","POPUP",Window.Width-128-option_offset,POPUP_TITLE_BG.Y+POPUP_BG.Height+32)
                  ?System.CreateByName("txt_option","POPUP",Window.Width-128-option_offset,POPUP_TITLE_BG.Y+POPUP_BG.Height+32)
                  ?#System.Create("txt_option","POPUP",Window.Width-128-option_offset,POPUP_TITLE_BG.Y+POPUP_BG.Height+32)
                  ?option_offset += 144

    The trouble starts when I try to assign Text values to those objects. I want to iterate through them and set every each instance with it's own option text. I've tried setting the text on creation and this method (found on SourceForge net page), just to set every instance with this text, for debug reasons:

    for t in txt_option:
         t.Text= "something"

    but it didn't work as expected. This sets the new text for only one instance, the one existing in the layout before the creation. Is there a way to do this at all? I really would prefer dynamic creation of objects rather than hiding / showing trick for objects already on the layout...

    Any help appreciated!

  • Sorry, for bumping such an old post, but for anybody who would ever search for a solution that somehow works.. I've managed to write a little script for Python and HashTable integration (I called it PyTable). I still hope to develop it some more (I do this mostly for myself, but would gladly share). Right now it can:

      create, read, change, delete STRINGS create, read, change, subtract, add, multiply, divide, delete INTEGERS create, read, add elements to a LIST create, read, change DICTIONARIES and DICT KEYS

    all written and stored in a CC HashTable plugin, could be accessed globally. If anybody would like to use it, here it goes:

    (script file, *.cap file, readme.txt)

    dropbox.com/s/yp3vzp3sakfpl04/PyTable.rar

    Edit: Also, I wouldn't have done it without Silent Cacophony's guides. You rock, man!

  • R0J0hound - thanks, but I'm aware of the syntax for this, as well as the 0/1 values for True/False in this case. The thing is - I've never been able to use it without a crash and critical error in my projects. I'm not complaining about lack of features, rather than stability of them. :)

  • Well, to be honest I'd LOVE some minor improvements / fixes, not really anything big but still. The things like not every function provided for Python by the System object works (it usually crashes the app). I mean, can't I really change the visibility of a layer by Python (there's a function for it, but it crashes anyway), by I can by using CC editor? Oddities like that. I can deal with the GUI and directx, in a matter of fact directx doesn't really bother me, I like it. And multiplatform? How about one platform (PC) but more stable for the player as well as the creator? Making one group of users really happy vs making various groups of people "eh... I suppose?".

  • No problem, I'm just glad I managed to fix it. And as a results of my experiments: one CAN use other Python libraries than only those provided in CC by compiling them (only 2.6 version, otherwise there will be a Magic Number error... first time seeing that I thought that some computer voodoo has gone bad) and adding into the Data folder. It's weird that somehow this 2.7 StringIO found its way into that folder in the first place...