dMZX Forums: random SAM numbers - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

random SAM numbers

#1 User is offline   Switchblade 

  • Let freedom ring with a shotgun blast.
  • PipPipPip
  • Group: Members
  • Posts: 210
  • Joined: 29-December 03
  • Gender:Male
  • Location:here

Posted 25 January 2007 - 06:02 AM

Is there a way to put in a counter instead of the number when you play a sam? This is what I did:

set "number" random 0 10
sam "&number&" "shell.wav"


When I played the sound in the game it just played it like it would if I put sam 0 "shell.wav".

If there isn't a way I could always do this:
set "number" random 0 10
goto "&number&"
end
: "0"
sam 0 "shell.wav"


and so on till I get to 10.

This post has been edited by Switchblade: 25 January 2007 - 06:03 AM

Fuck Jeff Goldbloom, man.
0

#2 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 25 January 2007 - 06:26 AM

Take away the ampersands.
user posted image
koji: SCRUMTRELLESCENT!
0

#3 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 25 January 2007 - 06:27 AM

You want
sam "number" "shell.wav"


Where MZX expects a number, you can replace it with "counter"
Only when MZX expects a string, like goto "", do you need to use ampersands.
-RoSS
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
0

#4 User is offline   Dr Lancer-X 

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

Posted 25 January 2007 - 06:58 AM

Or you could do

set "&number&" random 0 10
sam "&number&" "shell.wav"


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

#5 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 25 January 2007 - 07:23 AM

Lancer that's clever but it wouldn't work (in theory), because instead of setting "&number&" to random 1 to 10, you'd be setting "0" to random 1 to 10, because the first command DOES expect a string, which would be the counter. Do you follow me? I don't know if I'm following myself.
user posted image
koji: SCRUMTRELLESCENT!
0

#6 User is offline   Dr Lancer-X 

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

Posted 25 January 2007 - 07:27 AM

Actually, it would work, because you'd be setting "0" to the number (or whatever 'number' is) and then, with the sam command, you use the value of the counter "0", so it all works out!

Of course, you WOULDN'T do that, but you could =p
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#7 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 25 January 2007 - 07:41 AM

Actually, it wouldn't work. See, the first command expects a string, the second one doesn't. Therefore, you would be setting "0" and reading "&number&". Understand?
user posted image
koji: SCRUMTRELLESCENT!
0

#8 User is offline   Dr Lancer-X 

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

Posted 25 January 2007 - 08:02 AM

NO, they BOTH can expect strings. The second command parses the string as a COUNTER.

How else can I explain this?
Okay, let's say the counter "number" is 0 by default

set "&number&" random 0 10

that will parse 'number', creating a STRING that says 0.
That command is therefore interpreted as
set "0" random 0 10

now, the counter "0" is set to a random number, let's say 5.

Now, this command:
sam "&number&" "shell.wav"
'number' is parsed again, therefore the command is interpreted as:
sam "0" "shell.wav"

Because "0" is a counter, that therefore is equivalent to
set 5 "shell.wav"

Come on, I'm not a complete newbie!
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#9 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 25 January 2007 - 08:13 AM

Geez, it's annoying when you think you have the right answer 100% but it's wrong and you look like a idiot. I'm talking about me of course Lancer.

But you wouldn't use this way anyway. No point in taking a complicated route if a simple one is right in front of you.

edit: we're also getting off topic in a thread that was answered in the second post. By mwa. But we do love our hungry postcounts, don't we.

This post has been edited by CHEZZY: 25 January 2007 - 08:17 AM

user posted image
koji: SCRUMTRELLESCENT!
0

#10 User is offline   Dr Lancer-X 

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

Posted 25 January 2007 - 08:23 AM

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

#11 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 25 January 2007 - 08:31 AM

wow I just noticed how selfish that sounded. Oh well.

edit: Lancer, lets have another argument so our post counts go up! I'll start:

The stool was invented in switzerland

This post has been edited by CHEZZY: 25 January 2007 - 08:48 AM

user posted image
koji: SCRUMTRELLESCENT!
0

#12 User is offline   T-Bone 

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

Posted 25 January 2007 - 09:00 AM

Oh god, don't confuse the young man! Just take away those &
0

#13 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 25 January 2007 - 09:02 AM

I disagree Tbone, I say he's an old man!

ok I'll stop now
user posted image
koji: SCRUMTRELLESCENT!
0

#14 User is offline   Pyro1588 

  • wojtek
  • PipPip
  • Group: Members
  • Posts: 145
  • Joined: 20-October 02
  • Gender:Male
  • Location:Minnesota

Posted 25 January 2007 - 02:14 PM

[url="http://www.ioccc.org/"]http://www.ioccc.org/[/url]
we should have an obfuscated mzx code contest. it would rock.
<Tox> bah. I may as well give in and shop australia. D:
<pyro1588> "welcome to australia, can i help you find what you're looking for?"
<Tox> pyro1588, I'm giving you the most reproachful of glares right now.
--------
Go show those nutty Koreans what us crazy Europeans are made of pirate.gif pirate.gif pirate.gif - Saike
<exophase> The old Commodore strategy of, "Go friggin' bankrupt!"
<wervyn> Go away! I'm writing the same engine I always do!
0

#15 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 25 January 2007 - 02:43 PM

Lancer has already shown the IRC channel people an example of his code used to make a per-pixel game. Lets just say that if any obfuscated Robotic contest came along, he'd win.
0

#16 User is offline   Dr Lancer-X 

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

Posted 25 January 2007 - 02:44 PM

The code in question was:
Posted Image

Note that it's not actually MEANT to look ugly, it just sorta ended up that way. There were some really nasty single lines (that met the char limit), but those don't screenshot nearly as well.

The reason the funny characters are there is because I used the first 32 chars of the charset for counter names to increase counter access speed

Also, those sections of code aren't just copypasted--there are slight differences between them =p The appropriate section of code was reached by zapping a variable amount earlier on.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#17 User is offline   Pyro1588 

  • wojtek
  • PipPip
  • Group: Members
  • Posts: 145
  • Joined: 20-October 02
  • Gender:Male
  • Location:Minnesota

Posted 25 January 2007 - 02:58 PM

i've only overstretched the char limit once or twice. it's quite annoying to come within 20 chars of finishing an expression that will make your 2000-line robot work and then WAMMO! char limit =(
<Tox> bah. I may as well give in and shop australia. D:
<pyro1588> "welcome to australia, can i help you find what you're looking for?"
<Tox> pyro1588, I'm giving you the most reproachful of glares right now.
--------
Go show those nutty Koreans what us crazy Europeans are made of pirate.gif pirate.gif pirate.gif - Saike
<exophase> The old Commodore strategy of, "Go friggin' bankrupt!"
<wervyn> Go away! I'm writing the same engine I always do!
0

#18 User is offline   Switchblade 

  • Let freedom ring with a shotgun blast.
  • PipPipPip
  • Group: Members
  • Posts: 210
  • Joined: 29-December 03
  • Gender:Male
  • Location:here

Posted 26 January 2007 - 03:45 AM

Lancer-X, on Jan 25 2007, 02:58 AM, said:

Or you could do

set "&number&" random 0 10
sam "&number&" "shell.wav"


=P

Yea, Lancer, that's exactly what I did exept without the ampersands on the counter for the SET command.

Thanks for the help, guys.
Fuck Jeff Goldbloom, man.
0

#19 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 26 January 2007 - 10:20 PM

Logi and Lancer should fight it out for the most obfuscated code!
-RoSS
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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