Are Arrays Global?

  • It seems like they are...

  • @Deeeds Depends on where the Array is stored. If by global, you mean any object being able to access it. If the Array is stored in just a box container, then only the object with that box contained has access to it. But you can broadcast arrays, store them in attributes etc as text.

  • @Aidan-Oxley No, by 'Global' I mean that anywhere in the current Scene I seem to be able to get values from any Array inside any other object.

    I'm yet to understand what "Box Container" and the Value "container" actually are.

  • @Deeeds For now, I wouldn’t worry about the Value behaviour, you can try figure that out in your other post lol, because been I don’t really get the point of having Value behaviour versus Box Container. A box container literally just stores a bunch of text, that’s it. You can extract the text, or change it using set input field (or even dragging a behaviour output into it). Any object can get or set any array (by getting it as text, then using it in modify array or get array value behaviours) as long as you’ve given the object a way to access it.

  • @Aidan-Oxley Please stop talking about arrays as text. This is not what they are.

    And it's certainly not all that they are.

    Take a moment to go look up what arrays are, under the hood.

    Or, if you'd like, I can have a crack at explaining them in plain english.

  • @Deeeds I’m talking about hyperPad arrays. I’ve used them, as text. The text is obviously useless unless you use a behaviour to look at the array. I can make a behaviour attempt to get the array “hello”, and it will probably just output nothing because the text is is the wrong format. If an array isn’t just a bunch of text, why can I set a label to an array, have another object get the label’s text, and then use that in array behaviours?

  • @Deeeds - yes please, could you explain Arrays in a different way? They fascinate me but never been able to use them since I do not entirely understand what they are and more important “how, where and when” to use them.
    Thank you!

  • @Aidan-Oxley Because that's the way you're using an array, as a string store. But that's not what an array is, that's one of the ways it can be used.

  • Here’s an array, it’s storing a whole heap of stuff:
    I can paste this into a Get Array Value behaviour, and it will find values in there.

  • @Aidan-Oxley This is a string representation of the contents of an array. Not the array itself. Everything there is a string, including the [brackets]

  • @CAnesia Do you have any programming experience outside of hyperPad?

    And how much knowledge of the internals of a computer do you have?

    CPU, RAM, HDD... bits, bytes... etc??

  • @Deeeds Yes. That string is what the array looks like. You can use behaviours to extract the values from it. Value with index 0 is 66 in the above array. Value with index 1 is another array [“0”,”12”,”8”]. As long as an object has access to one of these strings of text, it can interact with that array.

  • @Deeeds I have no programming experience (other than things like Scratch and GameMaker) outside hyperPad, I partly know what my computer components do but I don’t know how they work. EDIT: Oops, I replied to a comment directed at CAnesia.

  • @Deeeds - Hardware understanding sure, I was selling computers and repair them in my 20’s.
    Programming some, hobby levels. I still look at programmers as “wizards” and used some of: VBA, LiveCode, Arduino some Lisp and tried Lua for a while beside hyperPad... still can not understand Arrays and never actually implemented them or actually use them.
    So please give it a try, maybe I’ll get them ...

  • @Aidan-Oxley @CAnesia asked for an explanation, so I was asking for a base point of understanding.

    But it's amazing to learn that about you. You've come a long way inside hyperPad and GamePress!!!

  • @CAnesia @Deeeds Will probably tell you something different, but here’s what I know about arrays:
    As far as I know, an array in hyperPad is a string of text in a specific format that stores multiple values. This is useful for times when you want to store multiple values at once, for one example you can broadcast a message with a single value in it, or you can broadcast an array with multiple values, some random example array: [“1”,”2”,”3”,], so that is 3 values (1,2,3) in one string of text. Using Get Array Value on that string of text with index set to 0 will output 1, index 1 outputs 2, and index 2 outputs 3.
    And because of how the format works, maybe you could see that you can have an array inside an array (so Get Array Value at it’s index will output another array that you can use). That example in my previous comment, the big array, stores an entire level for a game, the objects in the level and where they are positioned.

  • I’m explaining more how to use an array, not what one is.

  • @CAnesia @Aidan-Oxley

    Arrays: In English... Part 1!

    Imagine a road that goes forever over a flat plain. and there’s nothing there. Kind of like SimCity before you build anything. Just a huge expanse of nothing, with a road through it.

    That’s unused memory.

    Where we put things along that road is going to have an address. You’re the first person in this new land, so you build a house somewhere along this road, and number it:

    Number 1, Memory Road,

    Your friends come visit and they like your house. And the road. And the empty wasteland around it.

    So you give them the plans to your house, and the same amount of land as you have, and they all build houses, one after another, along the road, straight up from your place.

    They’re address numbers 2 through 16 along this road. Their houses are slightly different and their BBQ’s each very different, and they all buy furniture you don't understand and eat weirdly, but the amount of land they use up is all the same. Kind of like a modern gated community.

    Capitalism bringing us the conformity of communism without the social protections. Yippee.

    Because each house has its own number, and is exactly the same size, the newspaper delivery boy can ride past on his bike each morning, simply reaching into his basket and throwing papers into the yards of each house without thinking.

    It's SUPER simple for him. He rides at the same rate, pretty much looks straight ahead, and just reaches into the basket at a regular rate and throws a paper over his shoulder into each yard. Without thinking.

    Whilst singing out-loud, with headphones on. "You're gonna hear me Rooooaaaaar....."

    EASY! Even a moron can do it.

    The newspaper delivery boy loves this route because it’s the easiest 16 houses. Straight line, no thinking, just throw the papers at a regular rate whilst coasting at a regular speed on his bike.

    This is how computers see arrays. They LOVE them.

  • @Aidan-Oxley
    I need both explanations and your post described good enough for me to at least understand when to use it ... Thanks!

  • @Deeeds
    Yay! A very nice part 1 - one thing I assumed about them and you nailed it: CPU loves them (speed).

    Am I very wrong if I describe and think of an Array as a Excel sheet? - that is what I have in mind when I read something or hear Array

    Looking forward for the part 2

    For my curiosity: is clear that you are a “Vizard” and hyperPad is a joke for your level so why are you on hyperPad? Don’t get me wrong I surely appreciate you are a part of it ...

Log in to reply