The Daily Click ::. Forums ::. Klik Coding Help ::. Alt Value Transferring/Reading/Writing
 

Post Reply  Post Oekaki 
 

Posted By Message

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
30th December, 2015 at 30/12/2015 14:56:34 -

I think I'm going crazy. Or I've hit upon a limitation I've somehow never noticed before. Either way.

I'm currently building the second version of a tabletop strategy game and I have two different events that are causing me confusion.

The First Event:
User Middle-Clicks on object(Mob)

-> Set Counter(Whatever) to Alt Val X of Mob

Simple. Makes Sense. Works. Even with multiple instances of the Mob object running around, clicking on any one mob will update the counter with the value of the mob that has been clicked.

Second Event:
User Right-Clicks on object(Unit)

-> Set Alt Val A of object(valueholder) to Alt Val A of object(Unit)

Now, whenever this event executes, it will write the Alt Val A of the NEWEST object(Unit), and NOT the object(Unit) I've clicked. This is odd to me, because the two events only differ in the location it is writing the value.

I'm not sure what is going on. If this is some weird value-porting limitation to do with writing to Alt Vals of active objects please let me know. I understand there's a workaround in that I could set a counter value to X, then set the valueholder Alt Val to the counter value, but that seems unnecessary and bloated, especially when I have no idea why the above Second Event isn't executing as it should.

Thanks in advance!

 
n/a

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
30th December, 2015 at 30/12/2015 15:05:13 -

Actually, I just tried it with the Counter in the same Right Click command, and it's setting the counter to the newest objects alt value too, as opposed to the actual object clicked.

I know this for certain, as another middle click command sets a different counter to the correct alt val.

So is there an issue with a certain amount of loops and activated groups all executing off the same Right Click event?
A difference between left/middle/right clicking commands?

...voodoo?

 
n/a

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
30th December, 2015 at 30/12/2015 15:16:42 -

Right, so that was quick.

Moved the set value command up in the order of all the lines the program was executing, and now it works fine. Evidently something was changing said value, or interrupting it or something. Which I still find weird as I'm pretty sure there's only that one line that writes to that Alt Value, but anyway.

Seemingly, problem solved.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
30th December, 2015 at 30/12/2015 19:12:48 -

Glad you fixed it!

This sounds like an object scope problem.
By default all instances of an object are selected, but conditions (and some actions) can limit an action to a specific subset of that object.

So if you have a condition:

Object Alterable Value A = 1

Then only objects that fit that criteria would be selected.

Some actions can change the selected objects too. For example (and the only one I'm aware of actually) the create object action will select just that new instance of the object.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click