Help with clone stuff on a keypad?

helpwithcode

#1

Help with clone stuff, what a productive title XD .
I Wanted to do a number keyboard with numbers, like for the locked websites.
Except when I click a number, for example 1 on first number tapped in the game. It goes to 4.00234e+11 instead of simply, one. I tryed oio's project to only choose the selected number but I probaly made a mitsake.
https://c.gethopscotch.com/p/xuavwqloa
@justanerd ?
@oio ?
@BuildASnowman ?
Just people I think are mathy/mathsy
I know how to do it without the clones, but I want a quick way! (and less messy project when trying to code it


#2

me need liiiiinnnnkkkkk it fix the project :wink:


#3

Ask my brother. He is a grade ahead of me and we are the same age.


#4

Didn't I give link? Or that (ummm......) disney character?


#5

What is your brothers account?


#6

wait nvm I'm blind xD


#7

@tankt2016. We share the account. This is our account.


#8

Thanks

Can other member of @tankt2016 please help XD


#9

I will be pleased to create a project for you that enables keypad entry, if you will confirm that this is what you want / need. The more information you can give me, the more compatible my solution will likely be with your intended game / app / exercise. Just let me know. Thank you for asking. I enjoy and very much prefer this kind of discussion over the majority of rather impertinent non code-related topics that we see inundating the forum. I'll be thrilled, if I get a chance to help. :slightly_smiling:


#10
  1. Yeah, can't believe they have mod approval!
  2. One for numbers not letters, the numbers are easy, but when I used clones they backfired 🙁

Thanks!


#11

Got it. I just got home and will put something rudimentary together in the next few hours. If you would like to share anything about the rest of the project, I would be interested, though it is not essential.


#12

So, @Stampys_fans, I made the keypad thing. But I might as well ask, before posting it: What order on the screen do you prefer? Right now, I have 0 at the bottom, middle. Then the first full row on the bottom is 123, then the next row up 456, and the top row 789. Is that what you wanted?

Also: All it does now is show what digit has been pressed. Did you want more than that? Did you want it to assemble keypresses into an actual number? If so, how many digits long is the number? Think: 100*(first number) + 10*(second number) + (third number) or something along those lines. Or does it start with thousands? Or does it even matter?


#13

Not really, I can just remix adding the features I want (hopefully I'll understand..)


#14

I'm totally confident that you can. Ok, I'll name it and post it. Actually, I think you'll like the fact that this is a lot simpler than the code that you attempted to modify, since it didn't need to make the numbers draggable, etc. Just gimme a minute... (I'm in the middle of a recording session with the iPad)...


#15

K. It's out there. I'm on the computer, so pasting a link is kind of a pain. Can you just look it up? Actually... for other readers, i should probably edit-in a link, just in case it's useful to somebody else, too. Meh... :blush:

Here it is: Bare-bones Keypad Project


#16

Way more complicated than mine..... But it's fine, it does the job!


#17

@Stampys_fans, I am glad that what I posted "does the job" but I am even more glad that the rest of your comment gives us the chance to improve the code and to possibly help others who want to have a keypad in their projects. Would you be willing to give this a little more attention with me?

First of all, let me explain my motivation. When you say "Way more complicated than mine..." well... (1) to an engineer (like me), that could be a compliment or it could be an insult; (2) to a mathematician (also like me), that's an invitation; (3) to a physicist (also like me), that's a temptation; and (4) to a kid who grew-up on a farm (like me)... them thar's feudin' words! :laughing:

The only solutions I like are the elegant and simple ones. Let's go for that.

So, what you said to me motivated me to go look at your opening post a little closer. What I hadn't realized is that you actually posted (or edited-in) a link to your original code. I had totally missed that. Sorry. :blush:

I found the problem with your original code. It's really simple. You used a "greater than" operator instead of a "less than" operator in the "when numbers is tapped" conditional that identifies which number has been pressed! So, what your choice sets into motion is ALL of the clones EXCEPT for the one you actually WANT end up trying to do the math! Ha! :laughing: You needed to make it a "less than" operator. It happens...

Problem solved. Yay! And maybe that's all you care about... and all I should care about. But I wanna talk code. And, dang it, this is a great opportunity to do that.

Lets get back to this "complicated" thing. In what sense, exactly, is my very simple project one bit more complicated than yours? I'm trying to get my head around that. Can you answer my question here? Look at all the stuff you've got going on in your root-level spawning loop (the one with all the blue and yellow blocks in it). The solution I hastily put together is "way"... simpler. And, in fact, I see one way to make it even simpler yet; because, when I made it, I was distracted doing something else (making music).

The rest of the comparison between our code solutions looks like sixes to me.

I'll tell you what: I'll paste-in some code images in my next posts for the benefit of the community. I'll also ask you to change the title of this topic to something containing the words "keypad" or some such, so peeps can look it up in the future and get something useful out of it.

I know the problem is "solved", but let's think about others for just bit longer and contribute something useful. What I'd like to ask of you is to kindly offer a description of the ways in which we can improve my solution by simplifying it further.

Deal?


#18
  1. Just the sums like
    (square root symbol) X position x Y position for example
    Or
    Text X position - last touch X ^ 2
    Are a littke confuzing I mean, I don't really understand how it works, to be it looks like randoms sums, making you way smarter than me!
    Not being critical or anything bad, just either:
    Bad at wording things
    Or meaning it in a kind way
    Sorry if you asked another question I didn't realize was a question

#19

Hey, not a problem. I love this kind of topic! It's all in good fun. :laughing:

Way better than a lot of the other stuff people get their minds stuck on. Have you seen the dicey, contentious stuff going on in the other topics that have z.e.r.o. (0) relationship to code? Whoa... makes me sick.

By contrast, your topic is great. And your original solution appears to have been fine - just off by just a teensy bit: a "greater-than" operator. Otherwise, it was working! Have you checked it out?

Thanks for helping me understand what you thought the complicated part was in my solution. Our goal as coders is simplicity and elegance, and I find that there is always room for improvement along those lines in my stuff.


#20
  1. Yep. Can't believe they have mod avroval!
  2. Replublished, the two is 4000 more than its supposed to be!
  3. Got a late new new years resolution! :tada::tada::tada::tada:
    https://c.gethopscotch.com/p/xuiqoc95m