dMZX Forums: "What's the command that does X" questions - dMZX Forums

Jump to content

  • (8 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

"What's the command that does X" questions Post them here.

#121 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,943
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 29 May 2007 - 01:05 AM

it's PINNED
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#122 User is offline   Val 

  • ring ring zap
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,233
  • Joined: 19-February 04
  • Gender:Female
  • Location:Bartholomew

Posted 29 May 2007 - 01:26 AM

Well, I don't check individual forums--EVER--I always use "View new posts," and he may too.

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
0

#123 User is offline   hob nado 

  • Ancient Member
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 4,718
  • Joined: 23-September 00
  • Gender:Male

Posted 29 May 2007 - 04:00 AM

Pinning threads like that is always a good idea, but no one ever reads them. *shrug*
0

#124 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,943
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 29 May 2007 - 05:43 AM

there we go, merged in =p
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#125 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,263
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

Posted 29 May 2007 - 09:35 PM

Terryn, on May 28 2007, 06:15 PM, said:

uhh, no. DUPLICATE SELF can take an {x,y} pair too. Using COPY et al is not a good idea.

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
Need a dispenser here.
0

#126 User is offline   Val 

  • ring ring zap
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,233
  • Joined: 19-February 04
  • Gender:Female
  • Location:Bartholomew

Posted 30 May 2007 - 01:04 PM

CJA: "Green is a color."

Terryn: "uh, no. RED is a color."
0

#127 User is offline   Terryn 

  • ******
  • Group: DigiStaff
  • Posts: 2,966
  • Joined: 12-October 00
  • Gender:Male

Posted 30 May 2007 - 03:09 PM

You posited a choice between COPY commands (using x,y coordinates) and DUPLICATE SELF [dir]. There is absolutely no reason to use copy commands for that, and there are no solid indications in the thread that you can do DUPLICATE SELF # #, which would count as a different choice.

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!
angelic stream - shed sanguine - ill-adapt - avis - para/lyser - renaissance - dead tangent - phosphene blur - birth breeds death - ________ - painted glass - lagniappe

<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
0

#128 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,943
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 30 May 2007 - 03:25 PM

Terryn, on May 31 2007, 01:09 AM, said:

You posited a choice between COPY commands (using x,y coordinates) and DUPLICATE SELF [dir]. There is absolutely no reason to use copy commands for that, and there are no solid indications in the thread that you can do DUPLICATE SELF # #, which would count as a different choice.

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!
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#129 User is offline   Terryn 

  • ******
  • Group: DigiStaff
  • Posts: 2,966
  • Joined: 12-October 00
  • Gender:Male

Posted 30 May 2007 - 03:36 PM

Good point. Now that using COPY commands for Robots isn't functionally different anymore (i.e. it no longer saves the current line of the Robot copied) it can be used to plunk down any given Robot as opposed to just the one running the code, and it will act in the same manner of a Robot plunked down with a DUPLICATE SELF. I hadn't considered that considering its past problems and the resulting (bad) issues arising from it.
angelic stream - shed sanguine - ill-adapt - avis - para/lyser - renaissance - dead tangent - phosphene blur - birth breeds death - ________ - painted glass - lagniappe

<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
0

#130 User is offline   T-Bone 

  • Wastelander
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,487
  • Joined: 16-August 02
  • Gender:Male
  • Location:Canada

Posted 05 June 2007 - 06:10 AM

Hey guys, Its been quite a while since i asked questions about MZX robotics. I was wondering how to write values and read values to an external file using the f_write and such counters.

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

0

#131 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,263
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

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"

Need a dispenser here.
0

#132 User is offline   T-Bone 

  • Wastelander
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,487
  • Joined: 16-August 02
  • Gender:Male
  • Location:Canada

Posted 06 June 2007 - 04:08 PM

Awesome I shall check this out once i get home.

By the way, for the 3 loops is that for the number of counters added?
0

#133 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,263
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

Posted 06 June 2007 - 10:35 PM

well, that adds item0 through item3 to the file, since loops start at 0 and end at the number shown.
Need a dispenser here.
0

#134 User is offline   RoSS 

  • RIP Fred Friedberg 2004
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,283
  • Joined: 22-October 00
  • Gender:Male
  • Location:Right in front of behind you.

Post icon  Posted 07 June 2007 - 12:35 AM

If you just want it to do item1-n, you can either
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!).
-RoSS
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
0

#135 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,943
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 07 June 2007 - 01:10 AM

I can tell what that does immediately ^__^
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#136 User is offline   T-Bone 

  • Wastelander
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,487
  • Joined: 16-August 02
  • Gender:Male
  • Location:Canada

Posted 07 June 2007 - 04:35 PM

hmmm I must be doing something wrong. I'm trying to make it so that a robot will save the current stats (hp,mp,exp,etc...) to stats.dat and then load them later.

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

0

#137 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,263
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

Posted 07 June 2007 - 08:34 PM

you can have any range of numbers in a loop!

loop start
inc "loopcount" by "(('loopcount'=0)*'start')"
goto "#dostuffnow"
loop for "('end'-1)"

Need a dispenser here.
0

#138 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 08 June 2007 - 03:55 PM

I remember zombieguy's Loco having a counter at the end screen that showed how many seconds you have been playing. Is this counter built-in, and if so, why isn't it documented afaik?
0

#139 User is offline   Terryn 

  • ******
  • Group: DigiStaff
  • Posts: 2,966
  • Joined: 12-October 00
  • Gender:Male

Posted 08 June 2007 - 05:10 PM

It's built-in and documented, but not exactly like that.

MZX Help File said:

TIME_HOURS (read-only)
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.
angelic stream - shed sanguine - ill-adapt - avis - para/lyser - renaissance - dead tangent - phosphene blur - birth breeds death - ________ - painted glass - lagniappe

<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
0

#140 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,943
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 08 June 2007 - 09:08 PM

If you see something occurring in an MZX game, why not just look at the code and find out?
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#141 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 09 June 2007 - 06:06 AM

Terryn, on Jun 8 2007, 06:10 PM, said:

It's built-in and documented, but not exactly like that.

MZX Help File said:

TIME_HOURS (read-only)
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.
0

#142 User is offline   RoSS 

  • RIP Fred Friedberg 2004
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,283
  • Joined: 22-October 00
  • Gender:Male
  • Location:Right in front of behind you.

Post icon  Posted 09 June 2007 - 09:08 AM

You'd probably want to do something like

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.
-RoSS
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
0

#143 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,943
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 09 June 2007 - 09:28 AM

There's a few ways of increasing a counter by one for every second that passes. I personally prefer to do something like this:

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.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#144 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,263
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

Posted 09 June 2007 - 04:08 PM

so, basically, you want to just make an imaginary time unit called dashes or something and have 17 cycles be a dash
Need a dispenser here.
0

#145 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,943
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 09 June 2007 - 10:40 PM

No, this counts the number of actual seconds that passed. See, a 'cycle' is always a fixed period of time, to Megazeux. Cycles are only longer if the CPU can't keep up. For example, the CPU is never able to keep up with speed 1. I just increase 'ticker' by the number of MS that passed in the cycle, based on those values. This is of course the 'fairest' way of measuring time, because if your CPU is too slow you won't be penalised for it.

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).
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#146 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 10 June 2007 - 09:59 AM

OMG! Thanks tons Lancer! Really useful - I'll definetely use this code. :(
0

#147 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 10 June 2007 - 04:22 PM

Lancer-X, on Jun 9 2007, 04:28 AM, said:

There's a few ways of increasing a counter by one for every second that passes. I personally prefer to do something like this:

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)
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"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
0

#148 User is offline   RoSS 

  • RIP Fred Friedberg 2004
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,283
  • Joined: 22-October 00
  • Gender:Male
  • Location:Right in front of behind you.

Post icon  Posted 10 June 2007 - 05:52 PM

This is not going to be perfect, as it'll add a second every time you pause the game, but that's not such a big deal:
set "totalseconds" 0
set "lastsecond" -1
: "loop"
wait 1
if "lastsecond" = "TIME_SECONDS" "loop"
inc "totalseconds" 1
set "lastsecond" "TIME_SECONDS"
goto "loop"

-RoSS
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
0

#149 User is offline   RyanThunder 

  • Old-fashioned MZXer.
  • PipPipPipPip
  • Group: Members
  • Posts: 508
  • Joined: 09-November 02
  • Gender:Male

Posted 14 September 2007 - 05:56 AM

What's the command to change the player's maximum lives?
0

#150 User is offline   Terryn 

  • ******
  • Group: DigiStaff
  • Posts: 2,966
  • Joined: 12-October 00
  • Gender:Male

Posted 14 September 2007 - 07:32 AM

As far as I know, you can't change that in-game. You can only set it in the global options.
angelic stream - shed sanguine - ill-adapt - avis - para/lyser - renaissance - dead tangent - phosphene blur - birth breeds death - ________ - painted glass - lagniappe

<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
0

Share this topic:


  • (8 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

3 User(s) are reading this topic
0 members, 3 guests, 0 anonymous users