CloveltOc's Recent Forum Activity

  • Here's an example of doing parsing of a custom format:

    https://dl.dropboxusercontent.com/u/542 ... ormat.capx

    The advantage is you can customize it any way you'd like to make creating the data file easier. For example this one does without the xml tags or the need for all the comments and symbols of json. Also you can omit unused parameters.

    weapon
       id 0
       name sting
       perk glows when orcs are near
       damage 100
    weapon
       id 2
       name rusty sword
       damage 10[/code:6f6ung7e]
    
    To each his own though.  Personally I love creating something like this and dislike using xml or json unless I have to.  Another option could be to make your own editor to set the array data.
    

    This is THE BEST! I can't thank you enough for this Rojo...

  • > Yeah, that's what I meant, only one lastdata at a time.

    >

    Don't understand your problem.

    You can have:

    - 10 different file requests.

    - 10 different "AJAX on complete" with AJAX.lastdata inside.

    I stated earlier that I want to access all this data from different containers (arrays) instantly, I'd rather not risk it by loading files on runtime, which isn't instant... XML is nice, though, thanks!

  • > The idea is to make editing the data file easier since xml and json are tedious.

    >

    Easier to have your own format/parser?

    XML tedious?

    Disagree.

    One example of a xml dictionary that I'm using right now:

    <?xml version='1.0' encoding='utf-8'?>

    <dictionary version='1.0' selected_language='eng'>

    <word key='hi'>

    <translation language='spa'>Hola</translation>

    <translation language='eng'>Hello</translation>

    </word>

    <word key='bye'>

    <translation language='spa'>Adios</translation>

    <translation language='eng'>Good bye</translation>

    </word>

    </dictionary>

    What kind of file would be clearer than that?

    The XML parser in C2 is about 10 lines.

    Not trying to compete here! I know any syntax is better than mine, that's why I'm looking for alternatives.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Yup! Just saying that being able to load only one file at a time is quite a bummer

    >

    Mmm... that is not 100% correct.

    You can REQUEST multiple files and inside "On complete" AJAX.LastData refers only to the data loaded in the tag defined at your "On complete" event.

    Yeah, that's what I meant, only one files' lastdata at a time.

  • > Three types:

    > I need all of this data to be accesible without loading and unloading files with AJAX (not instant, sadly), that's why I copy them into arrays

    >

    It's not a "game" or "Construct" thing, It's web technology. AJAX is the way to access external files.

    Yup! Just saying that being able to load only one file at a time is quite a bummer

  • A "better way" is not to load those values from external files, but internal vars/arrays/dictionaries. You can have a configuration event sheet where you'll edit your values directly in C2. This way you will not need json, xml, or any other format but C2 conditions or actions.

    The answer you are looking for is: "it is internal or external", there is no other way.

    Hmmm, had not considered setting values manually onto array objects on a separate event sheet... Tedious, but clean and maybe not to annoying to edit? Still, editing from a text editor is more convinient for lots of values

    Would still like to know R0J0hound's opinion on this, though.

  • Three types:

    -Lists (names, dialog...). Used to pick a random index

    -Weapon parameters (10+ per weapon, lots of weapons). Used to pick current weapon parameters

    -Font kerning values

    All of these are in separate .txt's

    I need all of this data to be accesible without loading and unloading files with AJAX (not instant, sadly), that's why I copy them into arrays

  • 2. I don't understand your problem. Better solution for what?

    I have to use AJAX plus external files just to have arrays loaded with parameters, as reading directly from AJAX.lastdata would mean loading a file each time (not instant). A better way of handling this, is what I meant.

  • Wouldn't it lag? I've heard that loading big strings using that action causes freezing

  • Shameless bump...

  • Objective: (on start, happens once) fill arrays with predetermined data (names, parameters...) before the game starts. I want to be able to easily modify it.

    What I'm doing right now:

    I read each .txt (which is basically a construct array in .json) with AJAX, then copy all data with for loops into each array, so I can then do things like generating a name choosing randomly from the array. I can have each .txt in a text editor open, edit a value then save it and preview.

    I know there is a JSON/XML plugin and I've seen others do things like pasting array .json code directly into an action to load an array (which is said to be dangerous for framerate) or set each cell manually with actions in the event sheet.

    Is there a better/simpler solution?

  • Thanks, I guess I'll redo some of the code to support "on complete"

CloveltOc's avatar

CloveltOc

Member since 14 Mar, 2015

None one is following CloveltOc yet!

Connect with CloveltOc

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies