Magistross's Forum Posts

  • Just looked at the readfile() documentation. It writes the content of the file on the output stream then returns the count of bytes read. Simply lose the "echo" and keep "readfile('lista.xml');". The "792" should disappear.

  • There's a rogue "792" appended at the end of the XML response. Maybe Chrome's XML parser is able to deal with it but not Edge's and Firefox' ?

  • Edited the post in question, but kept the workaround in my previous quote, for posterity.

    Thanks again Mikal for being on the lookout!

  • The most useful post for installation is my first reply in the thread. I will quote it here for your conveniance :

    Here's the breakdown of what you should do :

    1. Copy these objects to your project (an event-less layout works wonder, like the "Dummy" layout) : ContinueIndicator, PortraitSprite, SpriteFont, WindowFrame

    (edit: Version 1.02 now needs additional objects : UpArrow, DownArrow, ChoiceSelector)

    2. Create these objects and name them like so :

    1 Array Object named "DialogueData"

    1 Dictionnary Object named "DialogueDictionary"

    1 Dictionnary Object named "DialogueCommands"

    1 Dictionnary Object named "GameVariables" (this is where you game should store its variables, so that dialogues can fetch them)

    1 Function Object named "Function" (default)

    1 Browser Object named "Browser" (default)

    1 Audio Object named "Audio" (default)

    3. Create a new event sheet, and copy over all the content from the "DialogueEvents" sheet from the template. If all objects were correctly copied / created, it should give no error message. (per haddy22 's remark, variables should be copied over before other events, so doing it in chunks might be better)

    4. Include this new event sheet inside whatever layout where you want to use the system.

    5. Be sure to have a "HUD" layer in all your layouts where you need dialogues. (You can also define your own layer by changing the "DIALOGUE_LAYER" constant)

    6. You can then initiate a dialogue with the "Dialogue_StartDialogue" function. It will start a dialogue with the data currently in the "DialogueData" array, or you can also provide a "key" parameter, it will then load the dialogue from the "DialogueDictionary" and start it. An AJAX call to retrieve either an array or a dictionnary JSON will most likely be needed.

    Please let me know if you need further help !

    edit: User mikal tried to import the template in a C3 project and found out that additional work must be done.

    > Porting to a project in Construct 3 took a few extra steps (I suggest editing the top post to include this).

    >

    > The sample project works fine, to include the template into an existing project takes a little more work.

    >

    > Since the current version of Construct 3 Beta (r66), does not seem to support copying between projects (Ashley turned it off when it was causing problems), you cannot copy the following objects from the template project to a new project, so you must create them (for example in Dummy layout) and then copy over the 'Animations' as needed from the original sprites in the template project.

    >

    > ContinueIndicator (sprite)

    > PortraitSprite (sprite with multiple animations from default test case)

    > SpriteFont (sprite font, add instance variable type string: 'ID', 'choiceFork')

    > WindowFrame (9 patch, add instance variable type string: 'ID')

    > UpArrow (sprite)

    > DownArrow (sprite)

    > ChoiceSelector (9 patch, add instance variables type string: 'callback', 'params')

    >

    Mikal also provided a nice barebone event sheet screenshot that should get you started. Thanks Mikal!

  • You can also use modulo 1 to get the fractional part. Also, int() behaves strangely with negative numbers.

    You can use abs() to change everything to positive and append a minus sign if needed using a conditional statement.

    (myVar < 0 ? "-" : "") & int(abs(myVar)) & "." & zeropad(round(abs((myVar%1)*100)),2)[/code:gkjyxtq4]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a common mistake. Loops and waits don't go well together. It *can* be useful to do a small amount of "repeats", combined with a "Wait loopindex * delayBetweenLoops"... that creates some kind of pseudo delayed loop execution.

  • Well, of course an infinite loop is gonna crash the system.

    And the "Wait 1 second" action is creating thousands upon thousands of "contexts" from which execution would resume from, and all that overhead needs memory... and looks like it needs a lot of it.

    Absolutely not a bug, it's something you should never do, like dividing by zero.

  • Updated my example. Download it again and you should be able to freeform draw.

    https://www.dropbox.com/s/5eqad3p64yfgs ... .capx?dl=0

  • Then you need to set the mouseX and mouseY variables to Mouse.X and Mouse.Y after each draw call, so that the next one will draw a "line" from the previous position to the current one, giving you a crude but effective illusion of freeform painting.

  • I'm not entirely sure what you want exactly, but I believe a staging canvas will help you achieve your goal. The staging canvas get cleared before every draw call, and the "real" canvas get drawn on only the left mouse button release.

    https://www.dropbox.com/s/5eqad3p64yfgs ... .capx?dl=0

  • Those "Clear canvas" on lines 2 and 3 certainly have something to do with it.

  • 1920x1080 and 1280x720 are both multiples of 640x360, or even 320x180 if you're willing to go that low.

    The reason why you can't have perfect letterboxed fullscreen with 1280x720 is because it's not a multiple of 480x270, so it goes to 960x540 and add black borders around your game window.

  • The easiest way would be to add a new global variable in the "DialogueEvents" sheet. This new variable should then be set to 1 at line 5 (right on the "Dialogue_StartDialogue" function trigger) and set to 0 on line 125 (on the "Dialogue_End" function trigger). It's also worth mentioning that those two specifics functions are the ideal place to hook some code of your own to disable and re-enable your movement behaviors.

    It would then only be a matter of checking whether or not this variable is equal to 0 before triggering a new call to "Dialogue_StartDialogue" (Line 3 of your capx).

  • The utility has a button used to download the dictionary of all dialogues. Even if you have only one dialogue, you still need to use this button if you want to use the Dialogue_StartDialogue("DialogueName") syntax.

    If you replace your JSON with this, it should work.

    {"c2dictionary":true,"data":{"Dialog_1":"{\"c2array\":true,\"size\":[4,7,1],\"data\":[[[\"Ffffffffff hhhh nnnnnnnnn sssssssssssssss rrrrrrrrrrrrrr\"],[1],[\"\"],[\"\"],[\"\"],[\"\"],[\"\"]],[[\"DDDDDDDDDDDDDDDDDD rrrrrrrrrrrrrrrr yyyyyyyyyyyyyyyyyy jjjjjjjjjjjjjjjjjjjj bbbbbbbbbbbbbbbbbbbbbbb dddddddddddddddddddddd\"],[1],[\"\"],[\"\"],[\"\"],[\"\"],[\"\"]],[[\"ttttttttttttttttttttt uuuuuuuuuuuuuuu!!!!!!!!!!!! \"],[1],[\"\"],[\"\"],[\"\"],[\"\"],[\"\"]],[[\"aaaaaaaaaaa qqqqqqqqqqqqqq tttttttttttttt nnnnnnnnnnnnnnnnnn\"],[1],[\"\"],[\"\"],[\"\"],[\"\"],[\"\"]]]}"}}[/code:16il451z]
    
    You should also make sure you don't open multiple dialogues at once. I might add a new global to the template to facilitate this.
  • I downloaded your file, so I was able to see what's wrong.

    You are using a single dialogue JSON to load as a dictionary. Use the "Download dictionary" button of the utility instead, change the file in your capx and everything should start working as intended.