View Full Version: Text Based RPG

Blitz Basement > Code Questions > Text Based RPG


Title: Text Based RPG
Description: me needs help


hiandmightywon - August 3, 2004 01:03 AM (GMT)
Im a newb with BB but have decided to create a text based RPG. Could some one help? Im going to copy the code. if you can help with it, do what you can to the code and email me the original and the new one with the changed bits.

thanks

heres the code:

Graphics 800,600
Print "Hello and welcome to my first RPG!
.label1
Print String$
name$ = Input$("Please input your name: ")
Print String$
Print name$
Print String$
correct$ = Input$("Is this correct?(1=no , 2=yes) ")
If (correct$=1)
Goto label1
EndIf
If (correct$=2)
Goto label2
EndIf

.label2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Graphics 800,600
Print "Good, " + name$ + ", we know your name now! Now on to phase 2."
.label3
Print String$
Print "(1)Elf"
Print "(2)Orc"
Print "(3)human"
Print String$
selection = Input$("Choose what race you would like to be: ")
If (selection=1)
Print "You are an Elf."
EndIf
If (selection=2)
Print "You are an Orc."
EndIf
If (selection=3)
Print "You are a Human."
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Graphics 800,600
Print String$
Print String$
Print "(1)Warrior"
Print "(2)Mage"
Print "(3)Archer"
Print "(4)Philosopher"
Print String$
selection2 = Input$("Chosse what class you would like to be: ")
Print String$
If (selection=1) And (selection2=1)
Print "You are an Elven Warrior."
EndIf
If (selection=1) And (selection2=2)
Print "You are an Elven Mage."
EndIf
If (selection=1) And (selection2=3)
Print "You are an Elven Archer."
EndIf
If (selection=1) And (selection2=4)
Print "You are an Elven Philosopher."
EndIf
;---------------------------------------------------
If (selection=2) And (selection2=1)
Print "You are an Orcan Warrior."
EndIf
If (selection=2) And (selection2=2)
Print "You are an Orcan Mage."
EndIf
If (selection=2) And (selection2=3)
Print "You are an Orcan Archer."
EndIf
If (selection=2) And (selection2=4)
Print "You are an Orcan Philosopher."
EndIf
;---------------------------------------------------
If (selection=3) And (selection2=1)
Print "You are a Human Warrior."
EndIf
If (selection=3) And (selection2=2)
Print "You are a Human Mage."
EndIf
If (selection=3) And (selection2=3)
Print "You are a Human Archer."
EndIf
If (selection=3) And (selection2=4)
Print "You are a Human Philosopher."
EndIf
sureness = Input$("Are you sure?(1=No , 2=Yes) ")
If (sureness=1)
Goto label3
EndIf
If (sureness=2)
Goto label4
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.label4
Graphics 800,600
Print String$
Print "(1)Gondor"
Print "(2)Mordor"
Print "(3)Rivendell"
Print String$
land$ = Input$("Choose where you are from: ")
Print String$
If (land$=1) And (selection=1) And (selection2=1)
Print "You are an Elven Warrior from the land of Gondor."
EndIf
If (land$=1) And (selection=1) And (selection2=2)
Print "you are an Elven Mage from the land of Gondor."
EndIf
If (land$=1) And (selection=1) And (selection2=3)
Print "You are an Elven Archer from the land of Gondor."
EndIf
If (land$=1) And (selection=1) And (selection2=4)
Print "You are an Elven Philosopher from the land of Gondor."
EndIf
If (land$=2) And (selection=1) And (selection2=1)
Print "You are an Elven Warrior from the land of Mordor."
EndIf
If (land$=2) And (selection=1) And (selection2=2)
Print "You are an Elven Mage from the land of Mordor."
EndIf
If (land$=2) And (selection=1) And (selection2=3)
Print "You are an Elven Archer from the land of Mordor."
EndIf
If (land$=2) And (selection=1) And (selection2=4)
Print "You are an Elven Philosopher from the land of Mordor."
EndIf
If (land$=3) And (selection=1) And (selection2=1)
Print "You are an Elven Warrior from the land of Rivendell."
EndIf
If (land$=3) And (selection=1) And (selection2=2)
Print "You are an Elven Mage from the land of Rivendell."
EndIf
If (land$=3) And (selection=1) And (selection2=3)
Print "You are an Elven Archer from the land of Rivendell."
EndIf
If (land$=3) And (selection=1) And (selection2=4)
Print "You are an Elven Philosopher from the land of Rivendell."
EndIf
If (land$=1) And (selection=2) And (selection2=1)
Print "You are an Orcan Warrior from the land of Gondor."
EndIf
If (land$=1) And (selection=2) And (selection2=2)
Print "You are an Orcan Mage from the land of Gondor."
EndIf
If (land$=1) And (selection=2) And (selection2=3)
Print "You are an Orcan Archer from the land of Gondor."
EndIf
If (land$=1) And (selection=2) And (selection2=4)
Print "You are an Orcan Philosopher from the land of Gondor."
EndIf
If (land$=2) And (selection=2) And (selection2=1)
Print "You are an Orcan Warrior from the land of Mordor."
EndIf
If (land$=2) And (selection=2) And (selection2=2)
Print "You are an Orcan Mage from the land of Mordor."
EndIf
If (land$=2) And (selection=2) And (selection2=3)
Print "You are an Orcan Archer from the land of Mordor."
EndIf
If (land$=2) And (selection=2) And (selection2=4)
Print "You are an Orcan Philosopher from the land of Mordor."
EndIf
If (land$=3) And (selection=2) And (selection2=1)
Print "You are an Orcan Warrior from the land of Rivendell."
EndIf
If (land$=3) And (selection=2) And (selection2=2)
Print "You are an Orcan Mage from the land of Rivendell."
EndIf
If (land$=3) And (selection=2) And (selection2=3)
Print "You are an Orcan Archer from the land of Rivendell."
EndIf
If (land$=3) And (selection=2) And (selection2=4)
Print "You are an Orcan Philosopher from the land of Rivendell."
EndIf
If (land$=1) And (selection=3) And (selection2=1)
Print "You are a Human Warrior from the land of Gondor."
EndIf
If (land$=1) And (selection=3) And (selection2=2)
Print "You are a Human Mage from the land of Gondor."
EndIf
If (land$=1) And (selection=3) And (selection2=3)
Print "You are a Human Archer from the land of Gondor."
EndIf
If (land$=1) And (selection=3) And (selection2=4)
Print "You are a Human Philosopher from the land of Gondor."
EndIf
If (land$=2) And (selection=3) And (selection2=1)
Print "You are a Human Warrior from the land of Mordor."
EndIf
If (land$=2) And (selection=3) And (selection2=2)
Print "You are a Human Mage from the land of Mordor."
EndIf
If (land$=2) And (selection=3) And (selection2=3)
Print "You are a Human Archer from the land of Mordor."
EndIf
If (land$=2) And (selection=3) And (selection2=4)
Print "You are a Human Philosopher from the land of Mordor."
EndIf
If (land$=3) And (selection=3) And (selection2=1)
Print "You are a Human Warrior from the land of Rivendell."
EndIf
If (land$=3) And (selection=3) And (selection2=2)
Print "You a are Human Mage from the land of Rivendell."
EndIf
If (land$=3) And (selection=3) And (selection2=3)
Print "You are a Human Archer from the land of Rivendell."
EndIf
If (land$=3) And (selection=3) And (selection2=4)
Print "You are a Human Philosopher from the land of Rivendell."
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sureness2 = Input$("Are you sure this is what you want?(1=no , 2=yes) ")
If (sureness2=1)
Goto label4
EndIf
If (sureness2=2)
Goto label5
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.label5

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; =----------------------------------------------=
;
; S M E A R E X A M P L E
;
; =----------------------------------------------=
;
; Author: Iain Bell
; Email: isb@scms.rgu.ac.uk
; Version: 1.0
;
; =----------------------------------------------=
;
; Requires timer to be set to control speed.
; Timer in this case is called "GameTimer".
;
; =----------------------------------------------=
; =---------------- CONSTANTS -------------------=
; Set our Screen Size
Global SCREEN_WIDTH = 640
Global SCREEN_HEIGHT = 480
; =------------- DECLARATIONS ------------------=
; Image handlers
Global BackgroundIMG
; Game Timer variables
Global GameTimer, Frames, FrameCount
; =------------- MAIN PROGRAM ------------------=
; Swap out display to graphics mode
Graphics SCREEN_WIDTH,SCREEN_HEIGHT
; Set up our double buffer
SetBuffer BackBuffer()
; Give our application a name
AppTitle "Smear Example"
; Switch mouse pointer off in window mode
HidePointer()
; Set up our game timer
GameTimer = CreateTimer(20)
; Loads graphic for the demo
BackgroundIMG = LoadImage("Back.jpg")
; Start Smear effect
SmeerImage(BackgroundIMG,2)
WaitKey()
; =------------- FUNCTIONS --------------------=
Function SmeerImage(ImageToSmear, Speed)
Local LineCount, YCount, i
; Start at the bottom of the screen
LineCount = SCREEN_HEIGHT
; Repeat for each line of ImageToSmear
Repeat
Frames=WaitTimer(GameTimer)
For FrameCount = 1 To Frames
; Update counter that determines how far up screen we are
LineCount = LineCount - Speed
Next
; Draw portion of screen that's now non-smeared
DrawBlockRect ImageToSmear, 0,LineCount, 0,LineCount,SCREEN_WIDTH,SCREEN_WIDTH-LineCount
; Calculate how far we start smear effect
YCount = LineCount
; Repeat until we've reached top of screen
Repeat
; For each line of Speed
For i = 1 To Speed
; Draw line of original image determined by LineCount
DrawBlockRect ImageToSmear, 0,YCount-i, 0,LineCount,SCREEN_WIDTH,1
Next
; Calculate next line to do
YCount = YCount - Speed
Until YCount < 0
; Flip screen
Flip
Until LineCount < 0
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



Print String$
WaitKey
End

Spamburglar - September 30, 2004 12:25 PM (GMT)
its a shitload longer than it has to be. Now with the .label3 part (aka phase 2) whatever you pick to be make that as your race variable.

Then in the LONG ass code for choosing what class you are just

have Print race$ + class$

and have like if selection2=1 then
class$ =" warrior"

man that goes the same for the where your from part. just turn the answer into a variable called like location$ and for the printing part you can just say Print "you are a" + race$ + class$ "from" + location$

wtf then you load a random smear example file made by ian bell.

Im not gonna rewrite this code but many u should start up doing something easier before tackling a text based rpg.

Sorry if what i said dint make sence and im sure some of my programming didnt make sense either but I was just trying to convey my point of using variables.




Hosted for free by InvisionFree