ramones's Recent Forum Activity

  • "something <en=""blah""> something something"[/code:1ivx26pl]
    
    Yo dawg I heard C2 likes quotes so I put quotes on your quotes.
    
    (or you can load from a file)
  • Yes, you can do that with the "Request URL" action.

  • Use "is overlapping" instead of "on collision" and it will work.

  • [attachment=0:2cmonj6z][/attachment:2cmonj6z]

  • Post a screenshot of what you have now.

  • Use int() to convert a string to an integer and str() to convert a number to a string.

    The value in webstorage is always saved as a string.

  • If you're calling execute javascript and HiScore is a C2 variable then you'll need something like:

    "....GameAPI.Score.submit(" & HiScore & ");...."[/code:3tmo6hwr]
  • The solution is to loop backwards, which you can't do with the array 'for each' but you could with a for loop. Or you can loop through the array storing the indices of the elements you want to delete in another array and then delete them in reverse order.

  • You could use a string to store the values and use tokenat() to get at the different parts.

  • It sounds like you are deleting from the array while looping through it.

    Imagine you want to loop through an array deleting any "A"s:

    array = ["A", "A", "B"]

    index = 0:

    it's an "A" so delete it

    array = ["A", "B"]

    now the "A" that was at position 1 has moved to position 0.

    index = 1:

    that's a "B"

    index = 2... done!

    array = ["A", "B"]... you missed an "A"

    Is that the problem you have?

  • It works for me. Have you got a "datafolder" folder created?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have to try remember what I did now...

    [quote:2clcdcdv]

    Problems:

    1) In Hero Select, the "members" array in your example shows up blank. Mine displays "Text" both when I'm working on the layout, and when I run it. Otherwise it works fine.

    That's just the default text showing before you set it to anything. You can change that in the text properties in the editor. Or on start of layout set the text to "".

    [quote:2clcdcdv]

    2) In Skill Select, preview functionality isn't working. For some reason, the "frame" parameter doesn't change from its initial value, and always shows frame 0... actually, this problem seems to have magically remedied itself since I began writing this response. Could Construct 2 confuse your capx (with edits) with my project when I open them both at once? Weird.

    Dunno...

    [quote:2clcdcdv]

    Questions (apologies, my notes are a little scattered, so these might jump around a bit):

    1) Line 5:

    a. Why do you destroy the initial "skills" array?

    Good question. I could've just used that array for the first hero.

    [quote:2clcdcdv]

    b. I assume that I'll just need to add a new array (with concomitant "addSkills" data) for each additional character I want the Skill Select layout to recognize. Is this correct?

    Yes but maybe the next step would be to put the hero data into separate project files and then loop through a list of heroes, creating a skills array for each one and loading the data from the matching file.

    [quote:2clcdcdv]

    2) Function.Param: I think when you set local variables equal to this expression, you're essentially creating a slot for information needed in order for the function to run. For example: when setting the parameters for the "addSkill" function, you set heroName = Function.Param(0), which means that, on calling this function, a heroName value will have to be supplied in order for the function to do the stuff it's supposed to do. Is my understanding correct?

    When you call a function like this:

    The parameters you set there can be accessed inside the function as Function.Param(0), Function.Param(1), etc.

    The local variable are just used to give them more readable names.

    It's nicer to say "Set array value to frameNumber" rather than "Set array value to Function.Param(3)".

    [quote:2clcdcdv]

    3) Line 46: I think this line is taking the information provided when addSkills is called to populate the active member's "skills" array. The first action puts the skillName (supplied in the "addSkills" section beginning with Line 6) into the skills array. The next two lines seem to be filling in the type and frame data in the array, but I don't understand why their location in the array is expressed at (self.Width-1, 1) and (self.Width-1, 2).

    Yeah so the array starts with a width of 0 and a height of 3. After 3 skills are added it looks like this:

    When you call the function to add another skill, first it pushes the skill name onto the array. That creates a new column:

    Then you want to put the type in the last column (width - 1) and row 1

    And the frame number goes in the last column, row 2:

    [quote:2clcdcdv]

    4) Is it correct to think of each line of data in the array (ie "Arthur", "attack", 0) as a point in a Cartesian coordinate system? Is there a better term for describing this than "line of data in the array"?

    Yeah, ignoring the negative axes, you can imagine each element in the array having an x, y, z position. The different heroes are along the x axis and their properties are along the y axis. Or a 2d array just think of a spreadsheet

    [quote:2clcdcdv]

    5) What establishes the CurX value for the skills array? (relevant to Line 53) What is the condition which sets the value for skillNumber doing?

    The "skills: For each X element" condition is looping through the x axis of the array and it sets the CurX value to the current x value as it loops.

    The other condition is picking the skillName text object that for each skill. So for the first element in the array, CurX = 0, it picks the text object with skillNumber = 1. Next element, CurX = 1, pick text with skillNumber = 2...

    [quote:2clcdcdv]

    6) Line 37: By the transitive property of equality, the parameters given for the "updatePreview" call are skills.At(skillName.Name, 1), (skillName.Name, 2). I think these correspond to the type and frame values in "the line of data" in the "skills" array that corresponds with that particular skillName.Name. Is that correct?

    Almost, only it's getting the index of the skillName. So yeah you have the name and you need to find the type and frameNumber to pass on to updatePreview().

    skills.IndexOf(SkillName.Name) gets the position of the name in the array and you can get the type and frame at that position.

    In the image above, if the skill was "Empathy" then skills.IndexOf("Empathy") = 3, and skills.At(3, 1) = "magic", skills.At(3, 2) = 8.

    [quote:2clcdcdv]

    7) As you may have surmised from my previous questions, I am having trouble understanding the relationship between various elements in arrays. Is ["Arthur", "attack", 0] a single data point, or three data points? Which (if any) of these correspond with Width, Height, Depth? Why, when establishing the parameters for a function call, is it written (self.Width-1, 1) or (skillIndex, 1)? These remind me of (x,y) coordinates, which is perhaps causing some confusion.

    Maybe it makes more sense now? Width, Height, Depth = X, Y, Z. If the Depth is set to 1 then you have a 2D array, like a 2D graph or a spreadsheet. If the Height is set to 1 as well then you have a 1D array; that's just a list.

    Also, self just refers to the current object. So the action:

    skills: Set value at (self.Width - 1, 1) to type

    is the same as

    skills: Set value at (skills.Width - 1, 1) to type

ramones's avatar

ramones

Member since 17 Apr, 2012

Twitter
ramones has 4 followers

Trophy Case

  • 12-Year Club
  • x4
    Coach One of your tutorials has over 1,000 readers
  • x2
    Educator One of your tutorials has over 10,000 readers
  • Email Verified

Progress

15/44
How to earn trophies