How to make an Array?

Avatar
Applzor
23 Posts
Posted May 10, 2011
Hey there guys,

Is it possible to make an array call to specific outputs

e.g.
If Integer = 0, Then: Output 1
If Integer = 1, Then: Output 2
If Integer = 2, Then: Output 3

I've been playing around with logic_compare and math_counter. with counters working the best, the only problem is I have to have multiple counters and it would be so much easy if there was a function that did things like, If 'this' Then 'do that'.

Advertisement
Registered users don’t see ads! Register now!
Avatar
msleeper
4,136 Posts
Admin
Posted May 10, 2011
Replied 1 hour later
Why do you need multiple math_counters? Can you explain in more detail precisely what you're trying to do?

The I/O system is pretty powerful, and I think using a math_counter and logic_compare would be the best way of making an "array". logic_compare is effectively "if value = X do this", you just have to setup each of those in it's Output.

Avatar
Applzor
23 Posts
Posted May 10, 2011
Replied 2 hours later
Basically I have a button,
Press it 1st time, a panel rotates 90degrees
Press it 2nd, the panel rotates back to original position
Press it 3rd, the panel rotates -90degrees
press it 4th, it rotates back to original and resets the pattern

Atm I'm using 1 math_counter to turn left, 1 to turn right 1 to turn centre.
I liked the idea of logic_compare but it only has equal to value, I guess if I change it's value constantly and compare value I could make it work.. I shall try this

edit: ok that won't work, it will still run the other outputs regardless as they are still equal to

Avatar
msleeper
4,136 Posts
Admin
Posted May 10, 2011
Replied 2 hours later
Uh. Why don't you just have the math_counter add? Set the button to tell the math_counter to Add 1. Then have the math_counter use the "OutValue" Output to the logic_compare.

Read this if you haven't: math_counter at the VDC

Avatar
ChickenMobile
2,460 Posts
Posted May 10, 2011
Replied 3 minutes later
Use logic_relays using each output on a separate relay (4 in total). Make the button trigger all the relays however have the last three disabled on start. On first press disable the first relay and enable the 2nd... second press disable second relay and enable third... etc.

That is how I would do it anyway, without too much confusion :smile:

Avatar
ChickenMobile
2,460 Posts
Posted May 10, 2011
Replied 1 minutes later

msleeper wrote:
Set the button to tell the math_counter to Add 1. Then have the math_counter use the "OutValue" Output to the logic_compare.

That would also work too xD

Avatar
msleeper
4,136 Posts
Admin
Posted May 10, 2011
Replied 1 minutes later
That setup (with 4 separate logic_relays) is a lot more complicated than using a single logic_compare.
Avatar
ChickenMobile
2,460 Posts
Posted May 10, 2011
Replied 16 minutes later

msleeper wrote:
That setup (with 4 separate logic_relays) is a lot more complicated than using a single logic_compare.

I didn't read your comment before posting. It is a better way, however my way is a completely different alternative.

Please keep in mind if you can't get the logic case to work :wink:

Avatar
Applzor
23 Posts
Posted May 11, 2011
Replied 10 hours later
I experimented with the 4 separate logic_relay, it works, but when you introduce more than one panel to be rotated... it gets pretty complicated and confusing fast. I'll try math_counter Output now
Avatar
msleeper
4,136 Posts
Admin
Posted May 11, 2011
Replied 8 minutes later
For the love of god, don't use 4 logic_relays. :neutral:
Avatar
Applzor
23 Posts
Posted May 11, 2011
Replied 33 minutes later
for the love of god I'm not
Avatar
MrTwoVideoCards
584 Posts
Posted May 11, 2011
Replied 1 hour later
Instead, why not have two buttons? I am sure that having two buttons would better communicate that based on their location against one another cause a panel to rotate either left or right.
Avatar
Hober
1,180 Posts
Posted May 11, 2011
Replied 14 hours later

MrTwoVideoCards wrote:
Instead, why not have two buttons? I am sure that having two buttons would better communicate that based on their location against one another cause a panel to rotate either left or right.

This. From an HCI perspective, having buttons that do single things is much more discoverable and clear from a player's perspective.

Second, two buttons with two states is essentially a two-bit number, which lets you count to four. I knew this computer science degree would come in handy eventually...

Avatar
Applzor
23 Posts
Posted May 12, 2011
Replied 10 hours later
Using 2 switches would be fine. I think atm I'm just want to be able to make it work because I'm stubborn and refuse to be defeated... also a great way to learn the workings of hammer
Advertisement
Registered users don’t see ads! Register now!
Avatar
MrTwoVideoCards
584 Posts
Posted May 12, 2011
Replied 8 minutes later
@Hober. Lol

But yeah man for reals, froma gameplay perspective thats ALWAYS a must. Goals and elements need to be extremely clear on how they function. You want the player to solve the puzzle, not solve how your entities work.