Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Cheats For Your Program

Author
Message
Lance Lumpy
20
Years of Service
User Offline
Joined: 21st Feb 2004
Location: On My Computer
Posted: 22nd Feb 2004 13:29
Does Anyone Know How To Let People Enter Cheats And Something Happens? I Am Using Dark Basic Classic.

Quote: "I Have Posted A Few Messages on This Forum And It Is Great!!!
Thanks Everyone! "


Support Everton FC - They're The Best!
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 22nd Feb 2004 14:05 Edited at: 22nd Feb 2004 15:31
call up a console somewhat like Quake or Halflife, in the main loop do this

if keystate(keycode) then gosub get_a_console_command

and then have a small snippet like this (this is just an example)

get_a_console_command:
input a$
if a$="impulse 101"
bullets=500
grenades=20
for i=1 to 9
gun(i)=1
next i
health=100
armour=100
endif
if a$="ghost"
gravity=0
hit_enabled=0
endif
if a$="win this level"
level_complete=1
playerx=245
playery=120
playerz=32
key=1
endif
return

enables you to enter three commands you may recognise , when you press the key allocated to the console, the game will pause and the cursor come up, you type in the command and press return and the appropriate values in the game get altered, hope thats what you meant.
The reason I used a gosub rather than a function in this example is that all those variables will most likley be global and you dont want to just alter them inside the function, or when you return to the main game loop they will not have been reset, so this is the easy way to do it, cheers.

Mentor.

Get Pro sorted, I am a customer not a BETA tester.
Lance Lumpy
20
Years of Service
User Offline
Joined: 21st Feb 2004
Location: On My Computer
Posted: 22nd Feb 2004 17:12
Thanks!

Support Everton FC - They're The Best!
The Lone Programmer
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 23rd Feb 2004 08:21
Um...
I know of another way watch:



Keystate 14=Backspace

When the user presses and holds for a second all those keys in that order then there money will increase. NOTE: I have found that this kind of stuff doesnt work unless the user pushes the keys in the order you want.

Hope I helped

Nicolas

comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 23rd Feb 2004 22:24 Edited at: 23rd Feb 2004 22:31
if you want to make it in that order do it like this



CURRENT PROJECT: RETRO PAC-MAN
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 23rd Feb 2004 22:48 Edited at: 23rd Feb 2004 22:52
Good start, Comando 300. One thing needs to be added to that, if you press any other key, 'i' should be reset to zero. Otherwise, someone could hammer keys at random until the total reaches 3.

Another way is to use a mouse and key combo. When the mouse is parked over a specific hot spot (like the third rivet on the left of your main screen's GUI), check for use of the function keys.
--
TAZ

Lance Lumpy
20
Years of Service
User Offline
Joined: 21st Feb 2004
Location: On My Computer
Posted: 24th Feb 2004 17:55
Thanks All!!!

Quote: "These Forms Are Useful"


Support Everton FC - They're The Best!
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 24th Feb 2004 23:07
Actually, there are tons of ways you can do this.

My favorite was in the old computer games where you had to be standing somewhere specific and then press a certain combination of keys to make yourself invincible or something.


Team EOD :: Programmer/Storyboard Assistant
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 24th Feb 2004 23:44
I like saving strings and their output in an array. Then I can scan the cheats array, compairing the entered string to all the 'access' strings, and if both strings match change things.

current_hp = 100
Type CheatInfo
Access as String
HP_Gain as Integer

Dim Cheats(NumberOfCheats) as CheatInfo
Cheats(1).Access = "Gimmeh t3h h34lth"
Cheats(1).HP_Gain = 10000000

Input "Please input a String";cheat_str$

Set Cursor 0,15 : Print "Processing"

for cheatnum = 1 to NumberOfCheats
If lower$(cheat_str$) = lower$(Cheats(CheatNum).Access) then Current_HP = Current_HP + Cheats(CheatNum).HP_Gain
Print "Health Cheat Activated"
else
Print "Invalid Cheat"
endif
next cheatnum

Psuedo code ^^


We need help! Email us! join@eternaldestinyonline.com

Login to post a reply

Server time is: 2024-09-21 22:34:19
Your offset time is: 2024-09-21 22:34:19