How to spawn a buddy?
-
This post is deleted! -
@iTap-Development Each buddy has a receive message, and looks to his variable (which should be unique) to see what "channel" he should be listening on.
This variable is set when he's spawned.
That part works
Him listening on the variable channel doesn't work.
-
@Deeeds are you willing to give a project to look at?
-
@iTap-Development No, I'm deep into something, and simply need to know... can a receiver use a variable as the Event Key?
That is the part that's not working.
-
@Deeeds as far as I know, yes. That’s why I suggested a project.
-
@iTap-Development Are you SURE it works? Have you ever done this?
Spawn and object. Let's call him Mate
Spawn an object to be Mate's Buddy
Mate sends a channelID to Buddy
Buddy sets that variable in his local storage.
Buddy's got a Receiver with an Event Key that's set to that locally stored variable.
Everything works except Buddy's receiver.
-
@iTap-Development @Aidan-Oxley I found the problem.
Buddy's Receiver is set by creating a copy of what's in the variable for itself, it's not a reference to the variable's contents (nor is looking contents via a pointer etc). So once it gets a value from the variable, it's got its own copy and isn't actually looking at the variable's contents to know what it's listening to.
In the initial Spawning, he's getting a null as the receiving channel because the variable hasn't yet been initialised.
And that never changes, even when the variable's value changes.
A very slight delay before activating the receiver forces it to set itself with that variable after the variable has been initialised with the value of the previously received ChannelID from his Mate.
This goes back to my other point, somewhere else, that I think broadcasting might be quite efficient, and that @hamed is setting up fast lookup tables for messaging and been a clever fella about how he's done messaging, even if nobody has bothered to describe how/why it works the way it does.
-
@Deeeds that’s why I suggested sharing a project! Glad you figured it out!
-
@iTap-Development How would that help to share a project for that?
This is why I asked you about conceptual thinking.
The question contains the problem.
-
@Deeeds because I could have looked at it and potentially found the problem, especially since I’ve built similar before.
-
@iTap-Development I'll say this once again:
The problem is CONCEPTUAL!
How does one do this kind of thing in this engine with its limited sense of relationships?
That is the question and the problem.
This is not about one specific effort, this is about understanding the limitations of this engine and its approaches to relationships.
Is it making sense what I'm asking, now?
-
@Deeeds you asked a specific question about a specific problem you were having with a specific behavior. Sure, you are wondering about the concept, but also specifically asked, “can a receiver use a variable as the Event Key?”. So stop with the concept nonsense.
-
@iTap-Development It's in the very first word of the original post:
"imagine"
-
@iTap-Development Think outside the bun.
The question, the Original post, is the problem trying to be solved. That is a CONCEPTUAL problem.
Along the way to solving that might be some examples, and I posited one, a buddy relationship. You're welcome to use other examples. But the problem remains conceptual. How does one reference a buddy of a spawned mate?
Whilst I thought I'd solved this problem, I have not.
Can you demonstrate that it's possible?
That might be a better way to use your literalist thinking.
Here's the example that demonstrates the problem.
Spawning 3 mates.
Each mate then spawns a buddy.
Each mate wants to be able to communicate with his buddy.
Is this possible in this engine?
At this point, I'm saying no. It seems broadcasting gets hung up around the first instance for the spawned buddy.
-
@Deeeds I’ll see about building that....I might not have time tonight, but I’ll try.
-
@Deeeds what would you like them to communicate?
-
@Deeeds is having the mate and buddy see each other’s position and move based on the position(or something like that) good enough?
-
@iTap-Development For an example of communication, think of something that can only be seen internally by mate and buddy. Say, for example, the result of some calculation in Mate that he wants to share with his buddy.
-
@iTap-Development and CHEERS ! For the time and consideration. THANK YOU!
-
@Deeeds Yes, it is possible, but not as easy as you’d like.
This is for my new “KrystalOS” (touch-screen OS simulator)
I’ve successfully made a Loop spawn my “App_Base” object, each of their X coord is unique (in the spawn Loop, SpawnObjectX = LoopIndex).After this loop finishes, another loop runs which broadcasts to each individual app by using their unique broadcast key (from the x position) in the broadcast, I send them their App Name and App Index.