"What's the command that does X" questions Post them here.
#211
Posted 15 June 2016 - 01:31 AM
Occasionally you need more parentheses in MZX than you would need in another language, but that downside is balanced by what I believe is the much bigger upside of _never_ having to wonder in what order something will be executed.

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#212
Posted 15 June 2016 - 02:21 AM
xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
#213
Posted 15 June 2016 - 04:33 AM
#214
Posted 15 June 2016 - 06:22 AM

I personally hate relying on order of operations, especially when it gets pretty hard to remember (and sometimes really non-intuitive) in C-like languages. Even worse when you throw in C++ style operator overloading. I almost always use parentheses when mixing operations in expressions, it makes it a lot easier for me to quickly parse the code I'm reading.
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#215
Posted 15 June 2016 - 06:51 AM
Exophase, on 15 June 2016 - 04:22 PM, said:
brb, overloading operator,()

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#216
Posted 15 June 2016 - 01:09 PM
Allright, I'll keep the lack of decimals in mind when I figure out how to make the rest of my game.
Your suggestion of simply putting the * before the / actually did the trick for my current problem!

I have no programming knowledge unlike most long time MZX'ers. I have used MZX mostly unassisted since around
2003 or something, but only recently have I attempted making something slightly more complex, which is why
I'm now running into all sorts of issues.
MZX isn't really a "competitive" game engine, but I love it anyway like you guys do. It's just fun.
Making a game in MZX is almost like playing a game. I'm trying to learn Unity but... yeah, I'll keep
playing with MZX because I'd just hate to see such a neat little thing die. I hope at least a handful
new games will be released every year for a good while yet.
This post has been edited by MicMotorhead: 15 June 2016 - 01:10 PM
#217
Posted 15 June 2016 - 09:46 PM
I just find it pretty sad that there's still no GCSs that can really equal MegaZeux for rapidly prototyping game concepts.

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#218
Posted 15 June 2016 - 11:16 PM
Dr Lancer-X, on 15 June 2016 - 10:46 PM, said:
I just find it pretty sad that there's still no GCSs that can really equal MegaZeux for rapidly prototyping game concepts.
I think one of the strengths of MZX - in a strange way - is that it can't do much more than text. It is no doubt frustrating at times to not be able to use some simple .gif sprites or break the limitations of the awkward rectangular blocks, but this simplicity makes MZX - like you said - ideal for making things quickly.
It's also kind of like a dogme movie. You got a set of rules you have to work inside, which forces you to be creative.
Still, it does happen frequently that I get an idea for a game, consider making it in MZX for a second, only to go "f*** it! Not gonna happen."
If only the graphics format was different, though... you could fool most people into thinking it was a far less archaic engine than it is. Personally, I think it's great that it just does 2D - I'd just like to work outisde of that stiff grid of rectangles and use some .png's or whatever. I have a soft spot for text mode games but I don't think most of the world feels the same way

This post has been edited by MicMotorhead: 15 June 2016 - 11:19 PM
#219
Posted 19 September 2019 - 09:13 AM
I'm in version 2.83b, I believe.
This post has been edited by MicMotorhead: 19 September 2019 - 09:13 AM
#220
Posted 19 September 2019 - 11:07 AM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#221
Posted 20 September 2019 - 01:07 PM
Dr Lancer-X, on 19 September 2019 - 12:07 PM, said:
Thanks, I'll look at it and see if the TRY command is maybe a better fit.
It's very strange though. I made a robot that goes north 3 spaces, resets back to the starting position, then south 3 spaces, back to start, etc., while always waiting for any eventual enemies that block it to get out of the way.
When I copied the robot and simply replaced all NORTH directions with WEST, and all SOUTH directions with EAST, the new object moves only west and south, but never east.
#222
Posted 24 September 2019 - 11:21 PM
MicMotorhead, on 20 September 2019 - 11:07 PM, said:
When I copied the robot and simply replaced all NORTH directions with WEST, and all SOUTH directions with EAST, the new object moves only west and south, but never east.
Could you paste a minimal code sample that reproduces the problem? Because I can confirm this works fine:
: "l" persistent go "wwweeeeeewww" goto "l"

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#223
Posted 30 May 2024 - 01:02 AM
Is there a way to do basic arithmetic using decimals? When I add a point to a number it defaults to be a string...
Im sure there's a way to handle it but I'm just not smart enough to find it in the help file.....I'm guessing it might be a splitting of a number and reconstructing the final value but I hope not...I
#224
Posted 30 May 2024 - 03:14 AM
Here's an example that uses a multiplication of 1000 to get three decimal digits if you're just trying to print decimal numbers:
set "mzx_speed" to 2 lockplayer set "spr0_refx" to "playerx" set "spr0_refy" to "playery" set "spr0_width" to 1 set "spr0_height" to 1 set "spr0_unbound" to 1 set "x" to 0 set "y" to 0 : "l" inc "x" by 1953 inc "y" by 1082 put c?? Sprite p00 at "('x'/1000)" "('y'/1000)" . "print the decimal portion into a string prefixed with 000 and then print only the last 3 digits of each string." set "$a" "000('x'%1000)" set "$b" "000('y'%1000)" * "x=('x'/1000).&$a+-3& y=('y'/1000).&$b+-3&" wait for 1 goto "l"
Here's an example that gives a sprite 8 bits of subpixel precision by storing the x and y values in terms of subpixels and using signed right shift to floor divide out the subpixels (this is much more useful for sprites due to its better rounding behavior for negative numbers):
set "mzx_speed" to 2 lockplayer set "spr0_refx" to "playerx" set "spr0_refy" to "playery" set "spr0_width" to 1 set "spr0_height" to 1 set "spr0_unbound" to 1 set "x" to 0 set "y" to 0 : "l" inc "x" by 500 inc "y" by 277 put c?? Sprite p00 at "('x'>>>8)" "('y'>>>8)" . "actually printing the precision in decimal is a little more involved..." set "$a" to "000('x'a255*1000>>>8)" set "$b" to "000('y'a255*1000>>>8)" * "x=('x'/256).&$a+-3& y=('y'/256).&$b+-3&" wait for 1 goto "l"
This post has been edited by Lachesis: 30 May 2024 - 03:43 AM
Reason for edit: added precision display and decimal version
xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
#225
Posted 31 May 2024 - 11:38 PM
For now I've been: fading out the game with color intensity during a cutscene, teleporting to that board, sending most of the memory hogging robots except some small ones and the one that will teleport me back to "die", and fading in back to another board after the cutscene board.Just wondering if there's an easier way.
#226
Posted 01 June 2024 - 01:52 AM
Potential alternatives to sending specific robots a label are the CHANGE command or using loops/COPY BLOCK to wipe the board contents. I don't know if either of those would be easier.
xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
#227
Posted 03 June 2024 - 02:35 AM
Lachesis, on 29 May 2024 - 11:14 PM, said:
The lack of floats sounds crazy these days, but it's understandable considering the age from when it came. I need to try programming in it again some day.