News:

Welcome to RetroCoders Community

Main Menu

homeless - a text game

Started by ron77_db, Apr 03, 2022, 06:30 AM

Previous topic - Next topic

ron77_db

#Lang "fb"

'_TITLE "HOMLESSNESS - A MIND SIMULATION V2.0"

Sub cp (row As integer, s As String)
	LOCATE (row, (80 - LEN(s)) / 2): PRINT s
END SUB

FUNCTION GetKey2 (keysToCatch As String)As String
	DIM k As String
	Do
		k = InKey
		WHILE LEN(k) = 0
			k = INKEY
			Sleep 1
		Wend
	LOOP UNTIL INSTR(keysToCatch, k)
	GetKey2 = k
END FUNCTION

SUB opening(senario() As String)
	Dim k As String, nam As String
	CLS
	cp 4, "HOMELESSNESS - SURVIVING THE STREETS"
	cp 6, "A MIND SIMULATION GAME"
	cp 8, "by ronblue77 (ron77)"
	cp 10, "IMPORTENT NOTE:"
	cp 11, "THIS GAME COMES TO BRING TO AWARENESS THE PROBLEM OF HOMLESSNESS"
	cp 12, "I DO NOT MEAN TO MOCK OR INSULT ANYONE! PLEASE HELP PUT AN END TO HOMELESSNESS"
	cp 16, "press ESC to quit or ENTER key to play"
	k = GetKey2(CHR(27) + CHR(13))
	IF k = Chr(27) THEN
		cp 19, "GOODBYE!": END
		CLS
	END IF
	CLS
	LOCATE (6, 14): INPUT "enter name: ", nam
	'inputc 6, "enter nam: "

	PRINT nam + senario(INT(RND * UBOUND(senario) + 1)): PRINT
	PRINT "GOOD LUCK!"
	SLEEP
END Sub

SUB main (senario() AS String,status() AS String,action() AS String,home() AS STRING, shelter() AS STRING, money() AS STRING, job() AS String,drug() AS String)
	Dim As Integer d2 = 1, health2 = 50, dollars2 = 20, over2 = 0
	Dim As Integer i , x
	Dim As String ac, result
	Do
		Cls
		cp 1, "press ESC to quit"
		cp 2, "day: " + STR(d2) + " health (0-100%): " + STR(health2) + "%  money: " + Str(dollars2) + "$"
		LOCATE (4, 10):x = Int(Rnd*UBound(status)+1): Print status(x)' PRINT status(INT(RND * UBOUND(status) + 1))
		PRINT
		FOR i = 1 TO 5
			PRINT action(i): PRINT
		NEXT i
		second_choice:
		ac = GetKey2("12345" + CHR(27))
		IF ac = CHR(27) THEN over2 = -1: EXIT SUB
		IF ac = "1" THEN
			x = INT(RND * UBOUND(money)+1)
			result = money(x)
			'result = money(INT(RND * UBOUND(money) + 1))
			PRINT result
			If result = money(4) THEN over2 = -1
			If result = money(1) OR result = money(2) OR result = money(3) THEN dollars2 += 20: health2 += 25
			sleep
		ElseIf ac = "2" THEN
			x = INT(RND * UBOUND(shelter)+1)
			result = shelter(x)
			'result = shelter(INT(RND * UBOUND(shelter) + 1))
			PRINT result
			If result = shelter(4) THEN over2 = -1
			sleep
		ElseIf ac = "3" THEN
			x = Int(Rnd* UBound(home)+1)
			result = home(x)
			'result = home(INT(RND * UBOUND(home) + 1))
			PRINT result
			If result = home(5) THEN over2 = -1
			sleep
		ELSEIF ac = "4" THEN
			If health2 > 20 THEN
				x = Int(Rnd* UBound(job)+1)
				result = job(x)
				'result = job(INT(RND * UBOUND(job) + 1))
				PRINT result
				If result = job(2) THEN over2 = -1
				sleep
			ELSE
				PRINT "NOBODY WILL HIYER YOU UNTIL YOUR HEALTH GETS BETTER CHOOSE OTHE OPTION": ac = "": GOTO second_choice
				sleep
			END IF
		ELSEIF ac = "5" THEN
			IF dollars2 >= 20 THEN
				health2 -= 20
				x = Int(Rnd* UBound(drug)+1)
				result = drug(x)
				'result = drug(INT(RND * UBOUND(drug) + 1))
				PRINT result
				If result = drug(4) THEN over2 = -1
				sleep
			ELSE
				PRINT "YOU DON'T HAVE ENOUGH MONEY CHOOSE OTHER OPTION": ac = "": GOTO second_choice
				sleep
			END IF
		END IF
		PRINT "press any key..."
		SLEEP
		PRINT
		finish:
		IF over2 = -1 THEN
			IF health2 <= 0 OR result = drug(4) OR result = shelter(4) OR result = money(4) THEN
				PRINT "YOU DIED ON THE STREETS - GAME OVER"
			ELSE
				PRINT "YOU SURVIVED THE STREETS - GAME OVER": PRINT
			END IF
			PRINT "YOU SURVIVED ON THE STREETS FOR: " + Str(d2) + " DAYS"
			SLEEP (3000)
			EXIT SUB
		ELSE
			d2 += 1
			dollars2 -= 10
			health2 -= 10
			IF health2 > 100 THEN health2 = 100
			IF dollars2 < 0 THEN dollars2 = 0
			IF health2 <= 0 THEN over2 = -1: GOTO finish
			CLS
			PRINT "press any key to continue to the nexy day"
			SLEEP
			CLS
		END If
	Loop Until over2 = -1
END Sub

SCREEN 0
Randomize Timer
Dim Shared As String senario(1 TO 3),status(1 TO 3),action(1 TO 5),home(1 TO 6)
Dim Shared As String shelter(1 TO 6), money(1 TO 5), job(1 TO 3),drug(1 TO 4)
Dim Shared i As Integer, ky2 As String
'Dim Shared As Integer d,over,dollars,health
FOR i = 1 TO 3
	READ senario(i)
NEXT i
FOR i = 1 TO 3
	READ status(i)
NEXT i
FOR i = 1 TO 5
	READ action(i)
NEXT i
FOR i = 1 TO 6
	READ home(i)
NEXT i
FOR i = 1 TO 6
	READ shelter(i)
NEXT i
FOR i = 1 TO 5
	READ money(i)
NEXT i
FOR i = 1 TO 3
	READ job(i)
NEXT i
FOR i = 1 TO 4
	READ drug(i)
NEXT i


DO
	'd = 1
	'over = 0
	'health = 50
	'dollars = 20
	opening(senario())
	'DO
	main (senario(),status(),action(),home(),shelter(), money(), job(),drug())


	'LOOP UNTIL over = -1

	PRINT "play again? y/n?:"
	ky2 = GetKey2("yn")
	IF LCASE(ky2) = "n" THEN END
Loop

'senarios:
DATA " you are runaway teenager that run from home... you need to survive on the streets till you can find a home."
DATA " you are a middle age person who's wife filed for divorce and throwed you from your house... you live in your old car till you get a new place to live."
DATA " you are brock with no job and no family... you have been kick out of your home now you have to find a solution to your problem."

'status
DATA "it's morning rise and shine... you almost don't have any money and you are hungry"
DATA "it's noon you have been sitting and begging for change from passing people some have given you some money"
DATA "it's night you are tired and need to find a safe place to sleep"

'actions
DATA "press 1 to: go beg or look for food or money"
DATA "press 2 to: find help and/or shelter"
DATA "press 3 to: call from a street phone to a family member or a friend to ask for help"
DATA "press 4 to: try to find a job or work"
DATA "press 5 to: do drugs or drink alcohol to forget the pain suffering and loneliness"

'call home
DATA "you call your grandma and you both cry... she promises to try to get you some help... she sends you her love... you promise to keep in touch with her"
DATA "you call a friend and she gives you some money and lets you stay at her place for the night... you get to have a good shower some clean cloths and eat a good meal and your back on the streets again"
DATA "you call a number of a hot-line for aid to homeless persons... the come and pick you up give some food and shelter for the night you talk to a social worker and he gives you his number just in case you need it"
DATA "you call a relative but no one answers... you are left alone on the streets"
DATA "you call your family and they pick you up and let you stay for as long as you need... you are off the streets"
DATA "you call but there is no answer"

'help or shelter
DATA "you go to a shelter for homeless people... you are robed from you money by violent addicts... you succeed to run away from there and spend the rest of the night at a park crying"
DATA "you try to sleep at the park but you get arrested by a policeman... you spend few hours in jail where you are beaten by inmates... by morning you are on the street again"
DATA "you have enough money to rent a motel room for the night... you shower and wash you cloths and sleep in a warm bed and dream you have a home"
DATA "you sleep at the park on a bench where you freeze to death cause of the cold weather... you are now in heaven RIP"
DATA "you sleep on the street on a corner when you wake up you find a 20 dollar bill and a note that says 'may god help you this is the little i can do'"
DATA "you are arrested by the police and now instead surviving on the street you have to survive being in jail"

'beg for money
DATA "you sit for hours and people pass you by as if you are invisible then some kind lady comes and invite you to eat at a dinner on her expense... you talk with her for two hours and tell her your story... then she says 'bye'"
DATA "you sit at a corner and people give you coins and dollars you get enough money to go by for a few days"
DATA "you sit and some men offers you work for some money and a meal you accept... you go to his house and help him paint his house then he gives you 10 dollars and a home cocked meal"
DATA "no one gives you nothing! your hungry and you have no choice but to look for food in the garbage... you get sick... very sick and you die on the streets from food poison... RIP"
DATA "you sit all day for nothing nobody gives you anything"

'job
DATA "you try to find work but nobody is interested"
DATA "you find work as a dishwasher at a dinner after a week you can afford a place to call home. you are off the street!"
DATA "you find work but you are fired really quick"

'drugs and alcohol
DATA "you get drunk and stone from cheep alcohol and for a few hours you forget about all your problems"
DATA "you do cheep street drugs and you get sick and collapse on the street... you wake up at the hospital and when you are better you are out on the street again"
DATA "you get stones and passed out when you wake in the morning everything you had is gone - you gut mugged"
DATA "you do drugs and over dose and die on the streets RIP"