dMZX Forums: A good key counter? - dMZX Forums

Jump to content

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

A good key counter?

#1 User is offline   RyanThunder 

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

Posted 21 December 2006 - 12:51 AM

Yo. RyanThunder here.

Alright, so I'm coding up a text-based HUD (meaning the HUD will be displayed via "*" command), and I want to add a Key counter to it, so that the player knows what color Keys he/she has.

Since there is no built-in Key counter, I'm looking for a simple, non-cumbersome way to do display colored Key chars. I'll even settle for a number counter that shows how many Keys the player has. Any suggestions?

This post has been edited by RyanThunder: 21 December 2006 - 12:52 AM

0

#2 User is offline   Risu2112 

  • I can't get the top off this bottle
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,864
  • Joined: 12-August 01
  • Gender:Male

Posted 21 December 2006 - 02:03 AM

"*" is for debugging My suggestion is don't sell your self short, don't use it.

Also don't use built in's they went out of style 8 years ago.
Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
0

#3 User is offline   RyanThunder 

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

Posted 21 December 2006 - 02:18 AM

I like using the "*" text command and I'm not talking about built-in enemies, I'm talking about built-in counters.

What does it matter if you use built-ins anyway? Doesn't mean it's going to make a person's game bad if you use just implement them properly.

Anyhow, any suggestions on my problem?

This post has been edited by RyanThunder: 21 December 2006 - 02:19 AM

0

#4 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 21 December 2006 - 02:23 AM

You could use a little bit of creative and do something like

loop start
set "numkeys&loopcount&" 0
:loop
take c?? key "loopcount" 1 "nomorekeys"
inc numkeys&loopcount& 1
goto "loop"
:nomorekeys
give c?? key "loopcount" "numkeys&loopcount&"
loop 15

That should work, although there's probably a better solution or at least way to code that, but the idea's there.

EDIT: Honestly though, there's no reason you can't just make your own robot keys and just have them set a counter. There's no particular advantage (although there seems to be a disadvantage!) to using the built-in keys.

. "bluekey"
end
:touch
inc bluekeys 1
die as item
end
-RoSS
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
0

#5 User is offline   RyanThunder 

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

Posted 21 December 2006 - 02:37 AM

That reminds me; how many Keys of the same color can the player carry in MegaZeux?
0

#6 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 21 December 2006 - 02:38 AM

RyanThunder, on Dec 20 2006, 09:37 PM, said:

That reminds me; how many Keys of the same color can the player carry in MegaZeux?

Why don't you just test it? It'll take like a minute =P
-RoSS
<img src="http://ross.box43.net/sig.php/sig.png" border="0" class="linked-sig-image" />
0

#7 User is offline   Dr Lancer-X 

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

Posted 21 December 2006 - 02:44 AM

So, you want to display the keys the player has in the * message? Okay

set "commands" to "(-1>>1)"

: "l"
set "$keystring" to ""
set "currentkey" to 0

: "keyloop"
inc "$keystring" by "~&+currentkey&"
set "nkeys" to 0
: "keyloop2"
takekey "currentkey" else "nomorekeys"
inc "$keystring" by "K"
inc "nkeys" by 1
goto "keyloop2"
: "nomorekeys"
if "nkeys" = 0 then "skipthat"
loop start
givekey "currentkey"
loop for "('nkeys'-1)"
: "skipthat"
inc "currentkey" by 1
if "currentkey" < 16 then "keyloop"
* "&$keystring&"
wait for 1
goto "l"


enjoy

EDIT: there, actually tested it and fixed it
EDIT 2: also replace 'K' with the char you use for keys.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#8 User is offline   Micah 

  • Ancient Member
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 5,330
  • Joined: 25-January 03
  • Gender:Male

Posted 21 December 2006 - 02:46 AM

I had a HUD display that showed which default keys the player had. I'll link it:

http://www.digitalmz...?showtopic=9538
♫ ▄ █ ▄ █ ▄ █ ▄
0

Share this topic:


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

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