I am about to lose it. I've done all I can, thought of the most ridiculous bits of programming to overcome Scratch's various limits, but I can take it no longer.
IS THERE ANY WAY, ANY AT ALL, THAT I CAN GET SCRATCH TO RECORD A X/Y POSITION AS 3 DIGITS ALL THE TIME, AND NOT JUST WHEN IT REQUIRES IT?!
A 002 or a 000 or a 040 or a 078? Is that too much to ask from a programming language that has spanned the globe, made many complicated programs and can still be used by a 7-year old. IS IT?
Please...... someone help me!
Offline
OK! I have the answer.
Make this your code:
If <length of (mouse x) = 1>
add (join (join _ _) mouse x)
Do the same for mouse y.
Make it so if mouse x = w, add (join _ mouse x).
Offline
I'm not sure what you want to do with negative numbers, but for the sake of simplicity, this'll only return a positive number.
If you also want it to be able to make it negative, add this to each if block:
Last edited by hmnwilson (2010-04-13 17:57:25)
Offline
Just put
Join <0><whatever you were using>
Offline
SeptimusHeap's way is the best way to do it. hmnwilson's might work, but trig can be confusing.
Offline
That doesn't use trig...
Just a simple join [0][x/y] block won't work if the X/Y position is only 1 digit.
Offline
I'll be more specific. I need a preferably short bit of code (as it's going to be repeated over 172800 times in the course of the program, and over that space of time, length of code is going to show) that will change ANY x/y position to 3 digits, NOT INCLUDING a minus sign. And what if the position is 0? Will it just display nothing? HELP!
Offline
hmnwilson wrote:
That doesn't use trig...
Just a simple join [0][x/y] block won't work if the X/Y position is only 1 digit.
<abs( )> isn't trig?
Offline
RacerZmanx1 wrote:
I'll be more specific. I need a preferably short bit of code (as it's going to be repeated over 172800 times in the course of the program, and over that space of time, length of code is going to show) that will change ANY x/y position to 3 digits, NOT INCLUDING a minus sign. And what if the position is 0? Will it just display nothing? HELP!
Mine will work.
Offline
Oh... I should have known that. I know absolute value. but abbreviations can confuse me.
Offline
16Skittles wrote:
Oh... I should have known that. I know absolute value. but abbreviations can confuse me.
Well, you should know what it does by looking at it and playing around. I'm thinking you don't know trigonometry and just want to say a complex word?
In all reality, I am a thinker like SeptimusHeap, I encountered that same problem before and I did something close to what he did.
Thanks goodness strings of text can be numbers. In Python or Java, they're completely separate.
Last edited by Greatdane (2010-04-14 10:23:23)
Offline
Thanks everyone! Both SeptimusHeap's and GreatDane's ideas worked, but in the end I went for GreatDane's as I thought it was neater. Sorry hmnwilson, but that was just too long for my use of it.
Offline