Magistross's Recent Forum Activity

  • Another option would be parsing CSV into 2D-arrays with events.

    This is quite easy -

    First loop breaks the file into lines using tokencount/tokenat and line break as separator.

    Second loop breaks each line into values with tokencount/tokenat and comma as separator.

    This is fine when you can be 100% sure that your values won't contain linebreaks nor commas. Otherwise, parsing CSV requires a bit more work than that.

  • You can use unbounded scrolling and have near infinite layout size.

  • Arrays aren't that hard to work with. However, as soon as you want to externalize your data, things get complicated a little bit. Your only recourse is the strict JSON format that you get when you use the "Array.AsJson" expression or when you invoke the "Download as JSON" action.

    Knowing that, it should be possible to create a script that can switch between plain CSV to C2/3 JSON array format. If you are using Excel, I guess a VBA script could do the trick.

  • 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' ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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]
  • 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.

Magistross's avatar

Magistross

Member since 4 Jul, 2011

Twitter
Magistross has 14 followers

Trophy Case

  • 13-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies