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

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
6th July, 2009 at 02:38:14 -

Umm .. ok ... well, that's interesting, but it still isn't completely solved.
I think you're on the right track though.
You see, it's not that the walls don't line up on the Y axis, as that's a non-issue, although your tackling it in such a manner has given rise to an idea slowly forming in my thick headed consciousness. You've got the groundwork laid out, it just has to be finished.

Let me explain. You see, what I need is for the walls to be able to stack upon one another in between the platform top (green platform) and the platform bottom (blue shadow). Your route of exploration towards the end solution has uncovered something that I had missed. What I now need is a formula to set walls upon eachother on the Y-axis up to a cut off point (where the top green platform is), but for more than one set of platforms and shadows. ... Is it even possible? ... hmm ... either that or just have to keep trying til I figure out a different way. It might work though, but how can I calculate such a thing? I'd need distance between the platform top and the shadow, the height of the walls at the intersecting overlap point, and then set the number of walls to align based upon that ... plus I'd need some sort of a division of the number of wall placements within that area between one platform top and bottom at a time only.

Confused yet? .. I certainly am!

If you can solve this, I'll hand over all my points to you (59. Edit: 598 points
And I'll owe you more points when I get them. Truly, this is a mind-bender for sure.


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
6th July, 2009 at 03:24:53 -

can you explain to me why you can't do it manually? It might help to chat over a messenger. . . do you have aim/yahoo/msn etc?

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
6th July, 2009 at 13:06:03 -

Well, I believe the solution is one of a mathematical nature, and to be quite honest, I'm not so good at anything more complicated than multiplication.

Lets say there's 3 rows of oranges (19 oranges total), and in the first row there are 4 oranges, in the second row there are 6 oranges, and in the third row there are 9 oranges. What is the mathematical formula which will split them in such a manner? And once that is found, how can that formula become alterable so that any amount of oranges can be put in whatever row you want without spilling the oranges from one row into another? Do you see what I'm saying?

I believe that changing the number which it is spread by (or maybe even spreading by a variable ever changeable number) could have something to do with getting it to work, but I have no clue how to get it all working mathematically, let alone implementing it into the code.

I have MSN messenger, for hotmail ... But I'm probably going to need someone who's heavily into math to help me.
Do you know much about mathematics? I vaguely remember something similar to this problem in an Algebra class when I was in school, but I don't know what the term for those kind of problems is or how they were solved.


 
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
6th July, 2009 at 15:19:03 -

I still don't understand why you cant place the walls manually with the grid.

Do you mean rows or columns?
------ row

|
|
|
column

If i am comprehending what you are saying, I can probably figure it out without the math being too difficult. I am no mathematician, but I am good at figuring shit out in MMF.

I'm working on an example right now, but I have to go to my shop soon. I'll try to work on it a bit there.

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
6th July, 2009 at 21:09:02 -

I mean a vertical row, so I guess column ... Why would I want to stack the walls horizontally for each shadow? .. think about it .. lol.
Row isn't necessarily horizontal btw, as it just means more than one item placed adjacent to one another in a line, and could be upon either the vertical or the horizontal either one, although it apparently seems to be thought of as horizontal more often than vertical for some reason ... column on the other hand is always of a vertical nature so I guess I should use that word rather than row, but row just sounds better to me <shrugs>.

You didn't test adding more than one wall stacked vertically. I know that because of the example. This is why you don't get my meaning. Try adding more walls on the vertical in the frame editor ok? .. then try adding walls vertically for each shadow. Do you see what happens with the code you changed? .. the wall instances all line up at the base of the shadow instead of stacking upon one another, and that simply will not do. Now do you see what happens with the original code if you add walls vertically? .. all the walls change places with one another and end up not lining up on the Y atop eachother above the correct shadow.

It's more complex than it seems. I'm usually pretty good at getting past TGF1 limits myself, (just take a look at the other parts of that code, all of my making), but I'm not so sure that this one can be solved without the magic of a complex Mathematical formula.
If you can figure it out though, then I'll be beyond amazed. I'm about to give up on it and just put all my shadows and platforms in the level first, then stack one wall on each from left to right, then do the same for the second wall to be stacked upon the other, then the same for the third and so on (because that is the ONLY way it will line them up right now) ... I have to follow an extremely ridiculous order of placement which makes everything much more time consuming. But, yea, if there's a way to avoid having to do that, well, that's what this whole thing is about. If only someone knew of a way ... do you know of any math sites where they help with problems like this? I'm gonna try hunting for math sites next.


 
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
8th July, 2009 at 01:11:33 -

I actually did test that. I knew that my code wouldn't allow for more than one wall per shadow. I thought I mentioned that - I just fixed the fact that you had to manually place the first wall in order for things to work.

I honestly do not see the benefit in doing this (considering how much of a pain it is and how long its taking) over manually placing the objects.

Haven't had time to look at it anymore though - I've been working on my own crap and I've been too busy with actual work as well.

Oh yea also.

Do the objects absolutely HAVE to have an ID? Or do they just have to align correctly.

If they don't need an actual ID, I think I have a method of pulling it off with a top platform, a bottom platform (shadow whatever), and center pieces.

If the values of the top and bottom platforms are equal, the distance is read between them then divided by the height of the center pieces. Then center pieces are placed every x amount of pixels. X being the height of the pieces. I'll post an example later so you can check it out.

Edited by GamesterXIII

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
8th July, 2009 at 02:13:16 -

Heres the example. Sorry for the double post, just figured you would be more likely to see it.

Hopefully i'm not going backwards with this =x.

http://www.megaupload.com/?d=2FW04APC

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
8th July, 2009 at 03:07:15 -

WOW! Very Nice ... What's your IQ?! ... You must be Genius level or something!

I believe this will solve my problem, but how do I put it into my messy code now? ...
It's a beautiful piece of work. This should be considered art and put up in a museum, that's how good it is.

I'm pretty sure it'll work because I already have a part of the code (the easy part), so if it doesn't conflict in any way,
(and I don't see why it would), then this truly is the answer! ... Lets hope that it is, as I'm so sick of that annoying problem, and I'm sure that you are too by now.

I can't thank you enough.

Edit: I'm gonna give you 300 points now and at least 300 more after I get more points and test to make sure the code meshes well with mine without conflict.


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 ?
   

Post Reply



 



Advertisement

Worth A Click