The Daily Click ::. Forums ::. Klik Coding Help ::. Spread Value Selection How to get more specific control?
 

Post Reply  Post Oekaki 
 

Posted By Message

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
30th June, 2009 at 17:46:08 -

Is there a way to display the Spreaded Value of the object instance the character is overlapping in a Counter?

I can't seem to figure out how to select a specific object instance by its ID number. I use the TGF "trick" which allows spread values to be useful at all, but if there were a "real" way to control them instead of all this workaround mess then things would be so much easier.
So does anyone know if there is a command to return the ID# of an object instance?


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

easyname



Registered
  15/04/2008
Points
  450
30th June, 2009 at 22:44:07 -

Character is overlapping object
-set counter to object spread value (which is an alterable value, right?)

Is this what you mean? :/

I'm not sure exactly what you want.

Edited by easyname

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
3rd July, 2009 at 03:49:29 -

Not entirely sure what I mean either. Guess that's part of the problem.

But I'm thinking that maybe the counters disappearing may be interfering with the spread value trick somehow.
I forget, what's the way to force the counters to stay in front at all times?


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
3rd July, 2009 at 04:06:04 -

Uncheck "Display as background"?

What is this "spread value trick" everyone keeps talking about? I never had to use tricks for spreading values in TGF1...

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
3rd July, 2009 at 06:53:38 -

Well, that thing PixelThief told me to do to get the Spread Value to change by +1 for each instance of a spreaded value active object is what I'm referring to when I say "spread value trick". For some reason, I can't get it to work, and I'm sure that I'm doing something wrong or have some sort of fluke in my code that keeps it from working, but have no idea what it could be.

Edit: If you don't force it to work right, then the spread value for each specific instance will change in either a random way or the wrong order. Whatever it is, it messes up the location placement when adding a new instance in the Frame/level editor, making it so that each time you want to add more walls and platforms to a level, they all have to be rearranged each and every single time.

If I didn't need the Spread Values for several reasons, then I wouldn't care so much, but the spread values are the only efficient way that I could come up with to get some code to work, and for some of it I'm not even sure if there is another way.


Edited by MBK

 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
3rd July, 2009 at 19:17:01 -

Someone already showed you how to display the objects value. You should have known that =p. Mouse/object/cow/whatever overlaps object > display value x (whichever one you spread a value into)

As for your "spread value trick" not working. . . is this what you mean?

Say you have 10 instances of an object with 1 spread into them so their values are equal to 1,2,3,4,5,6,7,8,9,10. Say you destroy #s 2,3,4,5,7. When you create another object do you want its spread value to equal to 11 instead of spreading one into all the objects again (which results in a different id for each one). This way you would have #s 1,6,8,9,10,11.

IF thats what you mean, then you could create a counter that handles the values for that specific object.

Heres a rough example
Start of level >
set counter to #of object
Spread 1 into value x of objects.

On object creation
Add 1 to counter
Set value x to counter value

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
4th July, 2009 at 05:23:31 -

Well, no ... what I mean is that Spread value 1 so that 1,2,3,4,5 numbered instances (it's fine if you make them all at once) .. ok .. now here's what happens after running the game once and then attempting to add just one more instance (it should be number 6) ...
it becomes backwards .. the first instance becomes 6 ... the rest become backward to so ... 6,5,4,3,2,1 ... and since the order changes in that manner, it no longer lines up with my other spreaded value objects, and poses a huge dilemma when creating levels because I have to re-build the entire level all at once (and then it still messes up for some reason usually). ...

GamesterXIII, that code may work though, I'll need to test it. Thanks much.
I still have yet to test in a normal example without my 2.5d code to interfere.
I'll post back once I've checked things out more thoroughly, hopefully one of you guys' solutions will do the trick.
Thanks for helping Everyone!


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
4th July, 2009 at 05:29:18 -

it never does that for me. i just do

always -> spread 1 to val

and when a new instance is introduced it correctly becomes the largest. dont know whats happening with yours.

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
4th July, 2009 at 07:34:41 -

yea thats really odd. sounds to me as if you are respreading the values every time an object is created.

I installed tgf earlier and just tested out cecils example.

Every time an object is destroyed, the values get set correctly. Values are spread in order from newest to oldest. Say you create 5 instances of an object in the level editor. The 5th one you created will have a value of 1 and the first one you created will have a value of 5. This is where the problem lies. Since you are adding one more instance at runtime, that new instance gets set its value set to 1 (when you are using always spread 1 into value) since it is the newest instance. I don't know why all of your values are becoming backwards though, perhaps what I said before about respreading every time a new instance is added?

If your code doesn't require the maximum value to equal the number of objects (ie 5 objects = values 1,2,3,4,5 vs 5 objects = values 1,3,7,9,12) my example >should< work. I haven't tested it as I am lazy and very tired atm =p.

-edit-
Went to bed then thought this up .

If your code DOES require the values to be in sequential order (1,2,3,4,5,6) rather than broken up, then you can fix my example by adding this.

Create a new counter

Object = destroyed - set counter to objects value

Object value > value of counter , subtract 1 from value

Use fastloops or manual loops (multiple instances of the same event) to make it happen.


Edited by GamesterXIII

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
4th July, 2009 at 21:45:30 -

Here is an example to allow everyone to better understand the problem.

http://www.mediafire.com/download.php?ndwjg0ngmzm


Now, a part of the problem is that I have absolutely no idea how to tell TGF1 "Upon Creation of Instance" or "Upon Deletion of Instance" either one. There is no way that I can see, but surely I must be missing something. OMC suggested upon creation of the instance to set the value for that instance created, but HOW?

I'll keep working at it ... guess I should probably put this example up in an Article as well so that more people will see it and then they too will understand this little backwards oddity. If one of you or I can't get this sorted out, then it'll take way too long to make levels with my 2.5d code and any similar code for that matter.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
5th July, 2009 at 00:34:27 -

If I read your post right, I think I may have solved your problem. It now does it the way you wanted it to, and detects on creation through the use of a flag.

http://sites.google.com/site/jlambsoft/Home/games/EditorSpreadNoProblem.gam

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
5th July, 2009 at 02:07:16 -

I've actually posted a solution to that aspect of the problem just before you got to it, but your way works too, thanks for posting it. However, I had to change an event in your example before it worked, "Start of level" to "Always" ... and I don't really know if it's working just because of the overlap or if there is an underlying scheme to it.

Check out the Article I wrote about the whole situation.
Apparently it's not even the issue, as it all still messes up in my 2.5d code. I've explained why there in the Article.
Thank You for Helping so far, but I'm unfortunately, Still in need of even more Help.

It's all laid out in a way to be understood on the Article page if you'd like to take a look! Thanks again!
Just so those who scan quick through stuff know easily, PROBLEM STILL NOT SOLVED YET! (sorry for that, but alot of people would see the thanks and think everything is all fixed when it's not, heh)


Edited by MBK

 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
5th July, 2009 at 04:04:55 -

I THINK i've fixed it for you through some odd work around shiz. 3 counters total (1 optional) and had to add 1 more active.

http://www.megaupload.com/?d=BD73VX09

enjoy.

edit
just looked at your article.If this does indeed fix your problem, your code is much shorter. All you have to do is add one line (an on creation event).

Whatever event creates the object
Set value A to #objects - 1

or you could do

Object flag 0 is off
Set flag 0 on
set alterable value a to #objects - 1

hope this helps =s





Edited by GamesterXIII

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
5th July, 2009 at 07:23:49 -

@GamesterXIII: Very Nice .. good stuff that, but apparently I've led all of you as well as myself astray a little bit, as this only solves the first portion of the issue.

Check back at the Article and download the 2.5d code on my bottom-most comment.
Pay attention to that comment btw, because it explains what the problem is.

Your fix is really interesting and intriguing GamesterXIII, especially since I don't understand what is happening to make it work, lol.
The only part I do understand is the left click to create and right click to delete .. heh .. why do you need more than one counter? ..
what's with the "real" and "fake" objects? .. it's baffling. And I thought that my coding style was abstract! .. very kewl stuff.
You know, I didn't even think to add creating and destroying during runtime. I just assumed that would be done in the level/frame editor. Sorta makes it easier as an example that way, so I wish I had thought of it. Not gonna re-upload my version just to add that though .. heh.

But, yea .. if you could check out the 2.5d wall code I put up on the Article and try to fix the wall placement issue, that'd be awesome. Thank You for solving the first problem, but it's only the first part of a bigger issue, so check it out on the Article page please. My gratitude and a few hundred DC points are all I have to offer if you can solve it, but I hope you try anyway!


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
5th July, 2009 at 15:43:40 -

here you go.

You had values spread, but they really didn't do much!

If you want multiple objects to align with each other based on their ID, they have to have matching values. You compare them to each other and align as such.

Now you can add as many shadows as you want in ANY order. As long as there are enough of the sensors (the brown object) and enough walls, they will automatically align themselves.

I put huge "LOOK HERE" comments in the events so you can see what I did.

=]

http://www.megaupload.com/?d=MN4XGAHD



 
n/a
   

Post Reply



 



Advertisement

Worth A Click