"What's the command that does X" questions Post them here.
#121
Posted 29 May 2007 - 01:05 AM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#122
Posted 29 May 2007 - 01:26 AM
Until of course my school decided to be DUMB and only block things from the New posts area when I directly clicked the thread, so I have to click on threads via the subforums
Anyway yeah I guess we should have pointed that out earlier
#123
Posted 29 May 2007 - 04:00 AM
#124
Posted 29 May 2007 - 05:43 AM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#125
Posted 29 May 2007 - 09:35 PM
Terryn, on May 28 2007, 06:15 PM, said:
If you want a robot to simply move, just use GOTOXY # # where # # are the {x,y} coordinates.
Well, sure, I never said it couldn't
#127
Posted 30 May 2007 - 03:09 PM
CJA: "Prominent countries in the Allies faction of WW2 were the US, the UK and France. Also, Canada since they were part of the UK."
Terryn: "...uhh, you didn't mention the USSR, but you mentioned Canada?"
And that is the point!
<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
#128
Posted 30 May 2007 - 03:25 PM
Terryn, on May 31 2007, 01:09 AM, said:
Actually, CJA posited 'copy' as an option to allow one to copy a robot from anywhere to that position, and in that it has a valid use. This form of copy is hardcoded into MZX and is relatively safe, and provides a useful feature not duplicated in 'duplicate self'. If he recommended the use of something like
copy "thisx" "thisy" # #
then your point would stand
See, my reasoning is based on the original question, which was asking how to place a robot. I guessed from there that Evulaye wanted to place an arbitrary robot at a position--this functionality would be more closely reproduced by the copy # # # # command than duplicate self, which defends CJA's choice of showing copy # # # # first.
Of course, it would be closer still to copy in a blank robot and then fill it with code with load_bc# or load_robot#, but I consider this to be a more advanced topic.
All that aside, I did think CJA's choice of showing DUPLICATE SELF [dir] was a bit odd!

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#129
Posted 30 May 2007 - 03:36 PM
<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
#130
Posted 05 June 2007 - 06:10 AM
I basically want to write counters like: hp, mp, exp, item1 , item2, etc... values to a file and be able to read and write to them. How would I go about doing this?
This post has been edited by T-bone6: 05 June 2007 - 06:18 AM
#131
Posted 05 June 2007 - 12:40 PM
set "stat.dat" "fwrite_open" set "fwrite_counter" "hp" set "fwrite_counter" "mp" set "fwrite_counter" "exp" loop start set "fwrite_counter" "item&loopcount&" loop for 3 set "" "fwrite_open"
set "stat.dat" "fread_open" set "hp" "fread_counter" set "mp" "fread_counter" set "exp" "fread_counter" loop start set "item&loopcount&" "fread_counter" loop for 3 set "" "fread_open"
#132
Posted 06 June 2007 - 04:08 PM
By the way, for the 3 loops is that for the number of counters added?
#133
Posted 06 June 2007 - 10:35 PM
#134
Posted 07 June 2007 - 12:35 AM
a)
loop start if "loopcount" = 0 "skip" set "item&loopcount&" "fread_counter" : "skip" loop for n
or b)
loop start set "item(&loopcount&+1)" "fread_counter" loop for n-1
The second one is cleaner but slightly less immediately obvious as to what it does (and yes, I do consider being able to tell what Robotic code is doing immediately a useful programming style... I'm looking at you lancer!).
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
#135
Posted 07 June 2007 - 01:10 AM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#136
Posted 07 June 2007 - 04:35 PM
I'm using:
set "hp" to 100
set "mp" to 50
set "exp" to 1
etc...
And from there the player plays the game and his stats will either grow or decrease. When the player saves, those counters will be saved to stats.dat. The player can then load those old stats.
EDIT:
Never mind it worked! This is fantastic! Thanks a bunch!
This post has been edited by T-bone6: 07 June 2007 - 04:38 PM
#137
Posted 07 June 2007 - 08:34 PM
loop start inc "loopcount" by "(('loopcount'=0)*'start')" goto "#dostuffnow" loop for "('end'-1)"
#138
Posted 08 June 2007 - 03:55 PM
#139
Posted 08 June 2007 - 05:10 PM
MZX Help File said:
TIME_MINUTES (read-only)
TIME_SECONDS (read-only)
Contain the current hour, minute and second respectively, based on the system clock, in 24-hour format.
You'll have to do some basic math to get time played.
<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
#140
Posted 08 June 2007 - 09:08 PM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#141
Posted 09 June 2007 - 06:06 AM
Terryn, on Jun 8 2007, 06:10 PM, said:
MZX Help File said:
TIME_MINUTES (read-only)
TIME_SECONDS (read-only)
Contain the current hour, minute and second respectively, based on the system clock, in 24-hour format.
You'll have to do some basic math to get time played.
So it's something in the global robot like
set "boot_timeh" "TIME_HOURS" set "boot_timem" "TIME_MINUTES" set "boot_times" "TIME_SECONDS" :idle wait 1 goto "idle" :endscreen . "this label is sent when the game ends" set "secondsplaying"...
OK I'm stuck with the formula there. *downloads Loco*
Thanks for the help anyways.
#142
Posted 09 June 2007 - 09:08 AM
set "boot_secondsintoday" "(('TIME_HOURS'*3600)+('TIME_MINUTES'*60)+'TIME_SECONDS')" ... set "final_secondsintoday" "(('TIME_HOURS'*3600)+('TIME_MINUTES'*60)+'TIME_SECONDS')" set "total_seconds" "( (('final_secondsintoday'<'boot_secondsintoday')*86400) + 'final_secondsintoday' - 'boot_secondsintoday')"
That code will calculate how many seconds it is into the day at boot and end (in a reasonably obvious way, I hope-- if you have questions feel free to ask them). The total seconds is usually just (final - boot), but I included a check to see if the day changed (like if you started playing at 11pm and ended at 1am it won't get confused, even though it would otherwise look like you've been playing for -22 hours!) which adds 86400 seconds (a full day) to the final time if need be.
Just know that this isn't really a very reliable way if seeing how long they actually spent playing the game. It's only the difference in time between when they happened to start the game and end it. A player who starts it on 2pm, plays for an hour, saves it, and then comes back the next day around 1pm and finishes it an hour later will look like he hasn't played at all! The most reliable way of getting the real number would simply be to have your global robot increasing a "total_seconds" counter once a second.
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
#143
Posted 09 June 2007 - 09:28 AM
set "ticker" to 0 set "seconds_elapsed" to 0 : "l" wait for 1 inc "ticker" by "('mzx_speed'-1*16)" inc "seconds_elapsed" by "('ticker'/1000)" set "ticker" to "('ticker'%1000)" goto "l"
That will count the number of seconds accurately, unaffected by MZX pauses (i.e. if MZX stops for something like a [ window or because the user brought up the 'Quit playing?' dialogue by pressing escape, time spent there won't be lost). On the other hand, if the game being played is faster than the computer can handle (ESPECIALLY if mzx is set to speed 1--as you can see, the timer won't work at all there), the amount of time calculated will be wrong.
There's another way some people like to do it, and that's by incrementing a counter every time the 'time_seconds' counter changes, but that will result in the timer being screwed up whenever MZX pauses for some reason, plus it depends on the system clock.

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#144
Posted 09 June 2007 - 04:08 PM
#145
Posted 09 June 2007 - 10:40 PM
MZX speed 1 - 0ms per cycle
MZX speed 2 - 16ms per cycle
MZX speed 3 - 32ms per cycle
MZX speed 4 - 48ms per cycle
MZX speed 5 - 64ms per cycle
MZX speed 6 - 80ms per cycle
MZX speed 7 - 96ms per cycle
MZX speed 8 - 112ms per cycle
MZX speed 9 - 128ms per cycle
Of course, if you just restrict the game to being played at speed 4, that's easy--every 125 cycles that pass, just add 6 seconds. (and interpolate for partway values at the end).

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#146
Posted 10 June 2007 - 09:59 AM

#147
Posted 10 June 2007 - 04:22 PM
Lancer-X, on Jun 9 2007, 04:28 AM, said:
set "ticker" to 0 set "seconds_elapsed" to 0 : "l" wait for 1 inc "ticker" by "('mzx_speed'-1*16)" inc "seconds_elapsed" by "('ticker'/1000)" set "ticker" to "('ticker'%1000)" goto "l"
That will count the number of seconds accurately, unaffected by MZX pauses (i.e. if MZX stops for something like a [ window or because the user brought up the 'Quit playing?' dialogue by pressing escape, time spent there won't be lost). On the other hand, if the game being played is faster than the computer can handle (ESPECIALLY if mzx is set to speed 1--as you can see, the timer won't work at all there), the amount of time calculated will be wrong.
There's another way some people like to do it, and that's by incrementing a counter every time the 'time_seconds' counter changes, but that will result in the timer being screwed up whenever MZX pauses for some reason, plus it depends on the system clock.
Cycles aren't going to be EXACTLY that time, if you keep doing that you'll accumulate significant error (not that it necessarily matters that much)
"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
#148
Posted 10 June 2007 - 05:52 PM
set "totalseconds" 0 set "lastsecond" -1 : "loop" wait 1 if "lastsecond" = "TIME_SECONDS" "loop" inc "totalseconds" 1 set "lastsecond" "TIME_SECONDS" goto "loop"
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
#150
Posted 14 September 2007 - 07:32 AM
<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111