playMaker

Author Topic: Letter to Int to String?[SOLVED]  (Read 2021 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Letter to Int to String?[SOLVED]
« on: September 14, 2017, 06:35:03 AM »
Hello. I want to have random-seeming numbers appear on a display when you use a level key to "orient the sensors" to point at the new level to load.

What I really want to do is take the level name, auto convert its first five letters to integers, and display that, so it's not random each time, and each level has a unique one.

Basically, you'll be able to input these numbers as passwords even in a brand new game to go to any level at any time, and they'll always display the same when you use a key.

for example:

you used the "secret lab" key on the keyhole?

s=19
e=5
c=3
r=18
e=5
t=20
new coordinates to display: 195.318.520

a letter to int action would save a lot of time. a letter to int to string action (convert 1 letter to a string after first converting it to an int) would save even another step.
« Last Edit: September 15, 2017, 04:53:01 AM by jeanfabre »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Letter to Int to String?
« Reply #1 on: September 14, 2017, 10:24:22 PM »
hi,
This is a very specific thing,
i think best is to an array for this.

if you want 'a' to be 1 leave "element 0" empty

Then place 'a' on "element 1" 'b' on "element 2" and so on

Then you can use array contains to look for the letter and save the index in a variable.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Letter to Int to String?
« Reply #2 on: September 15, 2017, 02:05:26 AM »
Hi,

 You could also use ArryMAker and hashtables then you would have keys and values which could be easier to setup and may be clearer visually.

 Bye

Jean

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: Letter to Int to String?
« Reply #3 on: September 15, 2017, 04:21:58 AM »
hey, guys. thanks. this makes it a lot simpler.