• Hi Guest!

    We are extremely excited to announce the release of our first Beta1.1 and the first release of our Public AddonKit!
    To participate in the Beta, a subscription to the Entertainer or Creator Tier is required. For access to the Public AddonKit you must be a Creator tier member. Once subscribed, download instructions can be found here.

    Click here for information and guides regarding the VaM2 beta. Join our Discord server for more announcements and community discussion about VaM2.
  • Hi Guest!

    VaM2 Resource Categories have now been added to the Hub! For information on posting VaM2 resources and details about VaM2 related changes to our Community Forums, please see our official announcement here.

VaM 1.x How to create a button for incremental changes?

Threads regarding the original VaM 1.x

Toddy

Active member
Joined
Aug 30, 2021
Messages
189
Reactions
33
I found a scene that by clicking on just one button the sound volume increased on every click. I have since deleted the scene and do not remember who made it. I would prefer to use a button with assigned increments instead of using a slider. Creating multiple buttons for this result is simple (I already created a subscene using multiple buttons) but I wish to reduce the number of buttons to only two. One to increase by 10 units on the scale and the other to decrease by 10.
 
Solution
I just tried to use LogicBricks Counter but I am having trouble setting it up. I wanted to set one click of the trigger to equal an increment of 10 or less on the audio volume scale. Consecutive clicks adds 10 until full volume is reached.
Build you a quick scene. Depends on LogicBricks.14:
  1. AptSpeaker atom
    1. EventAudioQueueEmpty brick to get a trigger signal whenever no audio is playing.
    2. RandomSound brick to play something random from VaM's build-in audio, in this case one of the Cyber modular tracks. So, 1+2 give us endless playing music 🔊.
    3. Counter brick is obviously the key.
      • OnChangeTrigger is set to change the volume AptSpeaker. We are mapping the 0.0 to 1.0 range of the...
You could use SequenceChoice and have each choice set volume in sequence: 0.000, 0.100, 0.200, 0.300, etc. One button trigger would use TriggerNext and the other would use TriggerPrevious.

 
Upvote 0
You could use SequenceChoice and have each choice set volume in sequence: 0.000, 0.100, 0.200, 0.300, etc. One button trigger would use TriggerNext and the other would use TriggerPrevious.

Exactly what I was looking for. Thanks
 
Upvote 0
Using a LogicBricks Counter is probably more suited. That way you don't have to setup a trigger for every step.
 
Upvote 0
Using a LogicBricks Counter is probably more suited. That way you don't have to setup a trigger for every step.
I just tried to use LogicBricks Counter but I am having trouble setting it up. I wanted to set one click of the trigger to equal an increment of 10 or less on the audio volume scale. Consecutive clicks adds 10 until full volume is reached.
 
Upvote 0
I just tried to use LogicBricks Counter but I am having trouble setting it up. I wanted to set one click of the trigger to equal an increment of 10 or less on the audio volume scale. Consecutive clicks adds 10 until full volume is reached.
Build you a quick scene. Depends on LogicBricks.14:
  1. AptSpeaker atom
    1. EventAudioQueueEmpty brick to get a trigger signal whenever no audio is playing.
    2. RandomSound brick to play something random from VaM's build-in audio, in this case one of the Cyber modular tracks. So, 1+2 give us endless playing music 🔊.
    3. Counter brick is obviously the key.
      • OnChangeTrigger is set to change the volume AptSpeaker. We are mapping the 0.0 to 1.0 range of the Counter brick to the same 0.0 to 1.0 of the volume. However, if we wanted, we could map 0.5 to 1.0 volume range for example.
      • OnChangeTrigger is ALSO setting the UISlider position. That's purely for visualizing what's happening.
      • Count is set to 10, meaning you got 10 steps to go from 0.0 to 1.0. That would be 0.0, 0.1, 0.2, ...., 0.9 and 1.0. If you want more or less steps, just change the Count.
  2. Two UIButton atoms
    1. The UP button is triggering CountUP on the Counter brick
    2. The DOWN button is triggering CountDOWN on the Counter brick
  3. UISlider
    1. Controlling the volume by trigger as well. So you can just control the volume by slider.....just in case that's what you actually want :ROFLMAO:
    2. (technically the Counter brick is setting the volume once directly and a second time again by setting the slider which then triggers the volume. So, it's a bit redundant.)
 

Attachments

  • VolumeExample.json
    16.4 KB · Views: 0
  • VolumeExample.jpg
    VolumeExample.jpg
    14.3 KB · Views: 0
Upvote 0
Solution
Build you a quick scene. Depends on LogicBricks.14:
  1. AptSpeaker atom
    1. EventAudioQueueEmpty brick to get a trigger signal whenever no audio is playing.
    2. RandomSound brick to play something random from VaM's build-in audio, in this case one of the Cyber modular tracks. So, 1+2 give us endless playing music 🔊.
    3. Counter brick is obviously the key.
      • OnChangeTrigger is set to change the volume AptSpeaker. We are mapping the 0.0 to 1.0 range of the Counter brick to the same 0.0 to 1.0 of the volume. However, if we wanted, we could map 0.5 to 1.0 volume range for example.
      • OnChangeTrigger is ALSO setting the UISlider position. That's purely for visualizing what's happening.
      • Count is set to 10, meaning you got 10 steps to go from 0.0 to 1.0. That would be 0.0, 0.1, 0.2, ...., 0.9 and 1.0. If you want more or less steps, just change the Count.
  2. Two UIButton atoms
    1. The UP button is triggering CountUP on the Counter brick
    2. The DOWN button is triggering CountDOWN on the Counter brick
  3. UISlider
    1. Controlling the volume by trigger as well. So you can just control the volume by slider.....just in case that's what you actually want :ROFLMAO:
    2. (technically the Counter brick is setting the volume once directly and a second time again by setting the slider which then triggers the volume. So, it's a bit redundant.)
Reading the description along with studying the scene was a great help. At first, I did not understand the Counter Brick. I assumed it only allowed an action to take place after a certain number of clicks were performed. So when I wanted a action to take place on the first click I set Counter Brick count to one. Thanks you very much for your help.
 
Upvote 0
Back
Top Bottom