playMaker

Author Topic: [SOLVED] Clamp int  (Read 2958 times)

Alatriste

  • Full Member
  • ***
  • Posts: 194
[SOLVED] Clamp int
« on: December 26, 2015, 06:30:57 AM »
Hi, I've never used this action before and I'm a bit confused about how to use it correctly.

In my scene, I'm using the "int clamp" order to specify the value of an int value to a min. of 0. However, later on I adding/substracting int values (in a range of 10) to that variable, but when it should stop at 0, it continues with -10.

Has to run the int Clamp order all the time while I'm doing operations with that variable, or the order is declared once and that's it?

Any help?
« Last Edit: December 30, 2015, 06:37:51 AM by Alatriste »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Clamp int
« Reply #1 on: December 27, 2015, 11:18:12 AM »
Hi,
The clam int should be in a active fsm state.
I am on my cellphone atm so i can not check this....

Make a new fsm anfd set in the start state the clamp int action.
If there is a checkbox "every frame" check it and try if that works.

Alatriste

  • Full Member
  • ***
  • Posts: 194
Re: Clamp int
« Reply #2 on: December 27, 2015, 12:03:21 PM »
Hi Djaydino, I did as you said but didn't work, running the action everyframe. The int clamp is between 0 and 100 and still goes to -10 when I substract.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Clamp int
« Reply #3 on: December 29, 2015, 02:03:36 AM »
Hi,
it should work, try this sample :

fsm 1 is clamping the int and displaying it in the game,
fsm 2 is deducting from the int value

if you stil can't get it to work, can you show some pictures or even better, can you show a video with the actions involved.


Alatriste

  • Full Member
  • ***
  • Posts: 194
Re: Clamp int
« Reply #4 on: December 30, 2015, 03:29:53 AM »
Thanks a lot djaydino.
I will give a few tries and if it doesn't work I will record a video so we can look at what I'm doing wrong. (it would be next week anyway, as now I'm in my laptop and I don't have the recording software)

Alatriste

  • Full Member
  • ***
  • Posts: 194
Re: Clamp int
« Reply #5 on: December 30, 2015, 06:36:38 AM »
Ok, I managed to make it work following your visual examples. I think the error was in the way I was handeling the variable. The int was working but because I didn't update every frame the result of the int converted to string var, the outcome was negative. I managed to make it work adding all the convert int to string and building the string for the text in the same state. That way it worked.

Thanks a lot djaydino!