WontoonRoo's Forum Posts

  • 13 posts
  • post the cap file, or a screenshot of your event sheet and a paste of your python

    it could be any number of problems.

    here's some questions which would be helpful in troubleshooting if you decide not post it

    what is 'File "gmdat" does not exist' , and what does it have to do with what follows

    is the function that makes the message box appear made with events then?, and the function object? is it called from events

    is it python that calls it?

    make sure your python is in events, if you don't want it to run every tick, one time things like defining python functions, etc should be done in start of layout.

    The function object and python functions of course let you run them once, or any time they are called. There is another error somewhere.

    before we figure out why python won't respond to the [1] text object, lets try to get rid of the nonstop creation of text objects.

    I first managed to solve the problem with the infinite functions. I totally deserve a fish in the face for that. :Op

    However, the python is still not working (It is on the Event Sheet, RPG functions)

    http://www.box.net/shared/cpzg7t01jm

  • Oh wait, I completely assumed that stuff on a page is read through once (except in some occasions). If I got you right, it means that runs through the page of events every single tick, a loop in and of itself? Oh wow. o.o

    This means I have to alter my approach to Construct drastically.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm extremely confused and bewildered and on and off with Construct, so once again I have a question. Is there a way to have a function run once? I honestly assumed that they did run once (since they are functions). I may be missing something, I do not know.

    Basically, I have been trying to make a message box that would appear once and be called anytime. Basically I have an event sheet that holds the functions for the game.

    On page 1 (The layout that sets stuff up), I have this

    File "gmdat" does not exist:
    My function: Add parameters (The parameters for the message box)
    Call function: myfunction (Forget picked objects)
    [/code:eaq1766k]
    
    On my page that contains the functions, one being for the message box,
    [code:eaq1766k]
    System: Create the Infobox object at params (3), (4) (x and y)
    System: Create a second instance of "Text" at Infobox's pivot point (Now there are only two instances of text, or there should be).
    Text: Set height to param(5)
    Text: Set width to param(6) - 30
    Text: Set text to param(7)
    [/code:eaq1766k]
    
    In theory, I should be able to then do this in Python:
    [code:eaq1766k]
    Text[1].Text = "This is a test."
    [/code:eaq1766k]
    ...since only one additional instance is made (I was forced to do it by the editor just to have it a global object that I can pull up anytime). The python script is in a sub event.
    
    Now here is where the problem comes in. When I put line of script in, anything above Text[0].Text did not work and gave me an error. I looked at the debugger and also saw that the game was creating an infinite amount of instances of "Infobox" and "Text".
    
    So I must ask, is there any way to have a function to run once (or is that impossible)? Also, why is the Python not grabbing other instances beyond the first?
  • I have came across something strange while making a test script for scaling boxes. I was trying for a couple of hours to get a box to scale in height. However, it was not working at all and I was trying it for hours. I then decided to switch to a global variable and behold, it worked! I do not know why it isn't working with the private variable.

    So, I have the .cap for you all. I probably did something stupidly wrong (If it is on the wiki I will facepalm).

    The funny thing is, the debug shows the private variable working, but the text is not picking it up for a reason I can't explain. The Private variable seems to work, but it doesn't get passed to the text object (which I don't get).

    Anyway, here's the cap. Anyone have an explanation for this?

    http://www.mediafire.com/?zwjtalggjjt

  • Oh wow. Very different than I imagined. I'm very grateful for you telling me (and posting the screenshots)

    So you're literally having to specify the parameters first (as Function.Param(number), and then adding the values later. I get it now.

    And then, AFTER telling specifing the parameters you can then use On Function.myFunction(parameter1,parameter2), so for the MessageBox...

    Messagebox.Param(1), MessageBox.Param(2), MessageBox.Param(3)

    Add parameter xpos

    Add parameter ypos

    Add parameter message

    Call function (And at this point on it works like a normal function)

    Again, thank you so much.

  • Odd, when I try to open them in Construct I get an "Out of Memory" error.

  • So I was inside of Construct tinkering around with a special project, when I came across the Function Object. I actually couldn't figure it out but I am assuming it is what I need to create what I want to create...

    For starters, I wanted to try my hand at doing something similar to

    messagebox(integer xpos, integer ypos, string message)
    {
             doStuff();
    }[/code:z417kdrq]
    
    But when I tried, I actually crashed the text EXE. I guess Function.Messagebox(x,y,"message") does not work. ;O)
    
    So I ask you guys, how is it used and how do you use it? What would be the equivelient of what I posted above in pseudocode? (The Wiki is down and plus, it wasn't clear on it last I checked it. But it did mention similar things as to how a normal function works last I recall!).
  • He did! *points accusingly*

    Mipey, Lucid, thanks for the responses! :O)

  • How do you initialize the value?

    Also, you don't have to use + and str() to display text; just use &, which concatenates strings; it will automatically convert numbers to text that way. So,

    "Character's HP is " & Characters(3,0)

    Okay, I just realized it. The Array is 1-indexed; the 0 is out of bounds, it doesn't exist. Rows and columns begin at 1; you should be setting it to (3,1), not (3,0). Actually, you can skip the second number and it will automatically get the first row.

    Oh wow, that did it. Didn't realize it was 1-indexed. That got it working.

    That needs to be included in the Wiki, I don't know if I can add that in myself.

  • Surely I must be doing something wrong, or I may have found a bad bug.

    I have an array named "Characters", and at 3,0 there is the value 340 (I have an initializing event set up) . I also have a text object for testing if I did this right.

    My string is this:

    "Character's HP is " + str(Characters(3,0))

    So, at 3,0 I should have gotten a value 340. Instead I have a 0, every time. I even tried other elements and got 0 for each one. To test further I saved the array to file and it was pretty much blank except for boxes and the text "ARR1.05".

    Have I stumbled upon a bug or did I do something wrong?

  • I actually figured it out thanks to Rich's suggestion (The timer thing, anyhoo, in the behavior thing).

    The result was much easier than I made it out to be initially. As a little bonus I even figured out how to make life bars using only boxes.

    Construct does take a bit of getting used to, I admit. And many thanks all who helped me on this!

  • Timers in general, actually.

    At least I think I read it right. You see, when I looked at timers I thought of "Do something after X amount of seconds" timers (Or in this case, milliseconds). That's where I am lost.

    In my example and testing, I'm trying to see if I can figure out timers and just get the final result.

    (Conditions)

    While

    "Boxsize" is between 0 and 20

    Every 1000 milliseconds

    (Actions)

    Add 1 to boxsize

    Box: Set height to box.x + 13

    The effect is to have a box slowly change size from small to large through a course of 20 seconds, but instead I just see the large box.

    Also, what I mean is preparing data to be used in an array for the first time. Like, item data (Just now tested to see how arrays are saved and got a whole lot of boxes; seems like they are saved by bits). From the looks of it it looks like I may be better off declaring the data in one big initializing event the first time, then loading the data afterward (saving each time something needs to be modified).

  • Let me say, I am liking Construct more and more.

    But I am curious as to know if there is a way to define data to be put into an array (Like, an option to put the info into the object's properties other than the size) or if the data has to be created when running the program (defined in an event sheet; sounds like the same but).

    Second, timers. I've looked around for them and wondered how those are used. Even the stuff in the platforming tutorial flew over my head when it used the timers. Like, there are some instances where I'd, say, want something to stop and wait a few seconds.

  • 13 posts