The Daily Click ::. Forums ::. Klik Coding Help ::. Only an advanced creative mind can solve this one...
 

Post Reply  Post Oekaki 
 

Posted By Message

Jon Chambers



Registered
  25/08/2002
Points
  1071
29th May, 2005 at 09:40:49 -

Okay, I hate to admit it, but this one is even beyond me...

Get this, a series of objects (all the same) have a series of flags on or off. Now how do I test to see if x number of objects have y number of flags in common, and also return the values of the common flags and objects.

Just an example to make sense of it. There are many objects on the field. One object has flags 1,6 and 9 on, while another has 1, 3, 4 and 9 on. I test to see if 2 have 2 in common, so it would return those two objects, and numbers 1 and 9.

Does that make sense? Coz I wrote it, and even I need to read it slowly to understand it.

If the question makes sense, but you don't know the anwer, write back to let me know that I have explained myself successfully.

 
Copy this to your hard drive. It will be worth alot when I'm famous.

Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
29th May, 2005 at 10:26:38 -

This sounds over complicated to me.

so... one object may have flag 1,2,3 on and another will have 1,3,5,9 on.
they both have to of the same on (1 and 3) and you want test that in the event editor

I think i understand, maybe writing the flag values in an ini or an array would help, also spread value. but otherwise i dunno.
it would take a long time to manually write each possibility in the events editor.

 
.

-Vinny-



Registered
  12/01/2005
Points
  436
29th May, 2005 at 10:37:08 -

see, it makes it all the harder to understand unless you tell us the intended result of this event, like what is supposed to happen, are you trying to get the enemies to do something? (i don't know if this is for enemies, but it would help others help you if they knew what you wanted to do, that way they aren't limited to solving this problem, which may or may not be the best solution, and can therefore give you better methods to perform the same task)

 
Vinny

Jon Chambers



Registered
  25/08/2002
Points
  1071
29th May, 2005 at 10:56:39 -

Trust me, I've thought about it and this is the only way. See, this is the core of a very complex system. I've gotten all the bugs out of every aspect except this one. I'll give you more details, but I'm afraid that if I tell you too much, you'll work out what I'm trying to do, and steal my idea.

There will be 9 objects tested at a time. Each object will have 9 flags. I'm not telling you what it is, but who ever helps me out may find thier name mentioned on the credits of a program they've never even heard of.

Although technically, it's a game, it's not a game as the click community knows it. I promise to release a demo onto TDC when I'm done.

 
Copy this to your hard drive. It will be worth alot when I'm famous.

Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.

Destroyer (CrobaSoft)



Registered
  10/10/2004
Points
  1106
29th May, 2005 at 11:41:53 -

Perhaps you can adapt this.
http://www.sitesled.com/members/destroyer/spread.cca
In this example you type in the flag you want to set ON in the edit box, then click on the object you want to have it's flag on. so if you typed in 2 in the edit box, and click an object, that object you clicked on, will have it's flag 2 on. Then you click the check button, and it figure out how many objects have flag 0,1 and 2 on. It only works for those, but should be easy enough to add the rest.

You'll need data store 2
http://click.spatang.com/ext/view.php?ext=124

 
Visit www.crobasoft.com or you're a Noob.

-Vinny-



Registered
  12/01/2005
Points
  436
29th May, 2005 at 16:01:54 -

ok then suit yourself, i'd help, but i'm not much of a reader, and i don't intend on deciphering the hidden point in your post

 
Vinny

Jon Chambers



Registered
  25/08/2002
Points
  1071
29th May, 2005 at 23:01:46 -

Okay, I've downloaded the file, but I know nothing about datastore. I also don't know how to work your demo, so I can't tell you if it's what I need or not. But if it is, your name goes in the credits for sure.

 
Copy this to your hard drive. It will be worth alot when I'm famous.

Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.

Jon Chambers



Registered
  25/08/2002
Points
  1071
30th May, 2005 at 01:35:19 -

hahaha. I hope you're kidding.

Yeah, I started to get an idea, but then it kinda didn't get much further. I'll share it with you guys to see if anyone can take it further.

I think that when the 9 objects are tested, each will be overlapped by one of 9 objects. This will allow me to distinguish each one.

So each object would record its relationship with each other object in a series of values individually.

Though, the problem is, I need a way of testing if 4 objects have 5 flags in common.

 
Copy this to your hard drive. It will be worth alot when I'm famous.

Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
30th May, 2005 at 06:43:06 -

Jon, you can't be all take and no give. If you want people to help you you'll have to be more explicit about what you're trying to do. No one is going to steal your idea. Someone may even propose a better system.

 
www.thenatflap.co.uk

Jon Chambers



Registered
  25/08/2002
Points
  1071
30th May, 2005 at 07:02:03 -

Turns out my idea is already stolen, but you must understand, this is the very core of what I'm trying to do. It is a VERY complex system surrounding this bug. I have put a lot of thought into getting EVERY other aspect working, but THIS one is beyond me. But I'll release any other details I can think of.


81 objects, tested 9 at a time. I must test for 1 with 8 flags, 2 with 7 flags in common, 3 with 6 flags in common, 4 with 5 flags in common, blah blah blah, right up to 8 with 1 flag in common.

Each time, it needs to know which flags are common, and which objects are involved.

 
Copy this to your hard drive. It will be worth alot when I'm famous.

Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.

Yai7

Peace & Love

Registered
  28/01/2002
Points
  3179

30th May, 2005 at 08:24:02 -

Basically: Here is an example in answer to your question.
http://144.bravepages.com/flagtest.zip

Be sure it works, And can be simply made.

 
(=

Jon Chambers



Registered
  25/08/2002
Points
  1071
30th May, 2005 at 09:40:31 -

Um, I don't understand that file, and I'm not sure what it's doing. Let me re-state from the top...

9 objects, each have 9 flags each. That is a total of 81 flags tested. (There is a total of 81 objects each with 9 flags, but I'm not testing that many at once.)

So, it must first test to see if it can find 8 objects with 1 flag in common. If it can't find one, it tests 7 objects to see if it can find 2 flags in common. If it can't do that, 6 objects, 3 flags. Then 5, 4. Then 4, 5. Then 3,6. 2,7, then finally it looks for an object with 8 flags.

If at any point it finds one, it must return values for: what each flag was, how many flags there were and which objects were involved.

I'm sorry for not explaining it that well in the first place. Looking at what I said then, it's the simplest I've ever put it. I feel I should start a new post with that explanation.

 
Copy this to your hard drive. It will be worth alot when I'm famous.

Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.

SculptureOfSoul



Registered
  14/03/2005
Points
  52
31st May, 2005 at 13:28:08 -

This is a quick response off the top of my head, and I'm sure there are better and more secure ways to implement it, but how about this...

Run a nested quick loop...the first loop runs 9 times, and on each iteration of the first loop the second loop runs X times (where X is the MAX number of flags you are testing).

The first loop should choose which object you want to test...the second loop then goes through each of that objects flags and if it is on, it enters it into an INI file and does some updating to the file.

Loop 1 -> choose object one -> start Loop 2 (X) times.

On Loop 2 (X):

IF Flag(x) is on:
write the current objects ID to the INI in "Flag " + GROUP[X]. Also, each group should have a way to keep track of the number of objects in it, so each group should have it's own counter: e.g.

[Flag 1]
counter=2
1=object one with flag 1 on
2=object 2 with flag 1 on

Now when you go to write to the INI, you must retrieve the value of "counter". Add 1 to that value and then convert it to a string before recording the next object in the INI.

Now, assuming you have soem kind of standardized algorithm that chooses which 9 objects to test, all you have to do is assign each object a unique ID. When the game chooses the 9 objects, it can store those objects ID's in an array in arrayelements[0] to arrayelements[8]. e.g:

ArrayElements[0]=3532355 <--first object to tests ID
ArrayElements[1]=4649922 <--second object to tests ID
and so on...

Now, when the first loop executes, use it's current iteration as an index into the ArrayElements[] array, and then use the resulting ID and compare it to the objects ID (probably stored in an alt. value). WHen you find the object start loop 2 and have it poll each of that objects flags, and then record them in the INI. When recording in the INI make sure you lookup the current objects ID by calling it from ArrayElements[X] where X is the iteration of the first loop.

If you had Object # 123 and it had flags 1, 2, and 3 on and you had object # 234 and it had flags 2,3, and 4 on the resulting INI would look like so

[Flag 1]
counter=1
1=123

[Flag 2]
counter=2
1=123
2=234

[Flag 3]
counter=2
1=123
2=234

[Flag 4]
counter=1
1=234

Then all you have to do is poll the INI by running another loop X times, where X is the max number of flags. On each iteration of the loop set an INI object to group
"Flag " + str$(X)

retrieve the value stored in the item 'counter' and see if the value is greater than 1.


Ugh, after typing this all out I think I came up with an easier way, but for now, this rough pseudocode idea should provide a framework for you to work with.

~SoS

 
Current Project: Undertaking the design of my mammoth RPG. Utilizing all of the knowledge gained while coding the now defunct "Shadow Reign".

Jon Chambers



Registered
  25/08/2002
Points
  1071
1st June, 2005 at 05:26:54 -

Thanks, I'll have another look at that when I'm more awake.

 
Copy this to your hard drive. It will be worth alot when I'm famous.

Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.
   

Post Reply



 



Advertisement

Worth A Click