playMaker

Author Topic: Convert String to Int not working (IS THIS A BUG?)  (Read 6805 times)

krane

  • Junior Playmaker
  • **
  • Posts: 63
Convert String to Int not working (IS THIS A BUG?)
« on: January 31, 2017, 05:08:03 PM »
I have a series of game objects that have been named with an integer (1, 2, 3, etc.)

I am getting the name of the object, and trying to store that as an integer.

But when I go to convert string to int, it doesn't work (see pic).
My steps are: Get owner (works correctly). Get name (works--stores name as string). Convert String to Int (doesn't work).

Is this something with the format of the string or some other problem? Or is it a bug?
« Last Edit: February 04, 2017, 09:26:49 AM by krane »

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: Convert String to Int not working (bug??)
« Reply #1 on: January 31, 2017, 07:41:02 PM »
This indeed looks (almost) right to me but because you've lined up all of those actions in one state, they not necessarily execute in the right order. You need to enable Action Sequence in order to process action-by-action in the state. In the top-right corner of that state window, there should be a dropdown menu and you can enable it there (gear icon).

Let me know if that works for you
« Last Edit: January 31, 2017, 07:43:07 PM by elusiven »

krane

  • Junior Playmaker
  • **
  • Posts: 63
Re: Convert String to Int not working (bug??)
« Reply #2 on: February 01, 2017, 09:22:12 AM »
No, that didn't solve the problem, and even breaking the actions up into different states didn't work either.

 :(

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Convert String to Int not working (bug??)
« Reply #3 on: February 01, 2017, 01:33:07 PM »
the same sequence works for me
if, just for testing, you swap the current int variable for a fresh one, does it work?

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: Convert String to Int not working (bug??)
« Reply #4 on: February 01, 2017, 06:56:50 PM »
Now that's very strange... Just to be sure, try separating them into different states and between each state add a state with Next frame action and enable debugging and open up FSM Log.

krane

  • Junior Playmaker
  • **
  • Posts: 63
Re: Convert String to Int not working (bug??)
« Reply #5 on: February 02, 2017, 08:50:59 AM »
Nope, neither of these solutions work.  Log shows no errors.
I'm attaching a package file to show the problem.

krane

  • Junior Playmaker
  • **
  • Posts: 63
Re: Convert String to Int not working (bug??)
« Reply #6 on: February 03, 2017, 08:54:07 AM »
(bump) Nobody?

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Convert String to Int not working (bug??)
« Reply #7 on: February 03, 2017, 10:13:15 AM »
Did you try converting the String to some other data type, then from that data type to Int? Trying to see if there's something wrong with the action itself.
Available for Playmaker work

krane

  • Junior Playmaker
  • **
  • Posts: 63
Re: Convert String to Int not working (bug??)
« Reply #8 on: February 03, 2017, 10:58:49 AM »
There is no action for converting a string to another data type.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Convert String to Int not working (IS THIS A BUG?)
« Reply #9 on: February 04, 2017, 10:32:36 AM »
You can do it in code. I'll check it out later.
Available for Playmaker work

marv

  • Junior Playmaker
  • **
  • Posts: 50
Re: Convert String to Int not working (IS THIS A BUG?)
« Reply #10 on: February 04, 2017, 10:54:48 AM »
There are a bunch on the ecosystem, to float, to bool etc.

If you don't use it yet, I can highly recommend it:
https://hutonggames.fogbugz.com/default.asp?W1181
« Last Edit: February 04, 2017, 10:56:37 AM by marv »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Available for Playmaker work

krane

  • Junior Playmaker
  • **
  • Posts: 63
Re: Convert String to Int not working (IS THIS A BUG?)
« Reply #12 on: February 04, 2017, 11:33:02 AM »
OK, it works when I convert it to a float, and then convert to an INT (but ONLY if I round up).

Still seems to be a bug. I'm going to report in bug reports.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Convert String to Int not working (IS THIS A BUG?)
« Reply #13 on: February 04, 2017, 03:16:48 PM »
It it doesn't work when rounded down or nearest, you should submit that too :)
Available for Playmaker work

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Convert String to Int not working (IS THIS A BUG?)
« Reply #14 on: February 06, 2017, 01:00:27 AM »
Hi,

 I downloaded your test package:

-- why did you implemented a next frame event every other state? to get a GameObject name, convert it to int and do an operation on this can be done in one state or a series of states without any frame delay.

-- ConvertStringToInt works converting "1" to 1 properly. I don't see where you have issues with this other than in your logic since you straight away substract -1 to that conversion leading to 0 in your case. Can you confirm you are aware of this?

If you have trouble with an action, do a scene with nothing but a start state and the action in it, so for example use ConvertStringToInt simply

 So in your case I think it's simply the substraction by -1 at the end that you should remove. Else let me know, we'll investigate further.

Bye,

 Jean