https://spectra.video/w/jA3EyjrJ7KifSbH6JZr8PH
made some serious progress on the shop component of the game.
the random item generator is now integrated into the shop system.
you are:
- able to buy items with sufficient currency
- able to choose which pocket you want your item to go into
problems:
- selecting a non-empty pocket to fill following a purchase will currently clobber the previous item
- not very polished
TLDR--please see the attached video.
10 DIM SHOPADJ$(16,10)
20 DIM SHOPNOUN$(16,10)
30 DIM SHOPITEM$(32,10)
40 DIM PLYRITEM$(32,10)
50 DIM PRICE(10)
60 OATS = 10000
70 CLS
80 PRINT "WELCOME TO THE OATS SHOP."
90 PRINT "BY VIDAK."
100 PRINT "PUBLIC DOMAIN LICENCE."
110 PRINT:PRINT
120 PRINT "ITEM # ..... PRICE (ø) ... ITEM NAME"
130 PRINT
140 FOR I = 1 TO 10
150 TMPADJ = INT(RND(50))+1
160 TMPNOUN = INT(RND(75))+51
170 PRICE(I)=INT(RND(100))+1
180 RESTORE TMPADJ
190 READ SHOPADJ$()(I)
200 RESTORE TMPNOUN
210 READ SHOPNOUN$()(I)
220 SHOPITEM$()(I)=SHOPADJ$()(I)+" "+SHOPNOUN$()(I)
230 NEXT I
240 FOR I = 1 TO 10
250 PRINT I;" .......... ";PRICE(I);" .......... ";SHOPITEM$()(I)
260 PRINT
270 NEXT
280 PRINT "NUMBER OF OATS IN YOUR POSSESSION: "; OATS
290 PRINT
300 PRINT "YOUR POCKETS:"
310 PRINT
320 FOR I = 1 TO 10
330 PRINT I;" ";
340 IF PLYRITEM$()(I) = "" THEN PRINT "Pocket empty !":GOTO 360
350 PRINT PLYRITEM$()(I)
360 NEXT I
370 PRINT "SELECT AN ITEM TO BUY. (1-10)"
380 INPUT ITEMBUY
390 IF ITEMBUY > 10 OR ITEMBUY < 1 THEN PRINT "INVALID ITEM NUMBER.":ENDSHOP
400 IF OATS < PRICE(ITEMBUY) THEN PRINT "OATS INSUFFICIENT":ENDSHOP
410 PRINT "SELECT A POCKET INTO WHICH TO PLACE THE ITEM (1-10)"
420 INPUT POCKET
430 IF POCKET > 10 OR POCKET < 1 THEN PRINT "INVALID POCKET NUMBER.":GOTO 420
440 PLYRITEM$()(POCKET)=SHOPITEM$()(ITEMBUY)
450 OATS = OATS - PRICE(ITEMBUY)
460 SHOPITEM$()(ITEMBUY) = ""
470 PRICE(ITEMBUY) = 0
480 PRINT PLYRITEM$()(POCKET);" OBTAINED."
490 PRINT
500 PRINT "PLACED INSIDE POCKET NUMBER "; POCKET
510 PRINT
520 GOTO 240
REM Adjectives
REM 50 tokens
1000 DATA "good","bad","great","horrible","perfect","beautiful","simple","handsome","gorgeous","plain","cute","messy","fancy","pretty","cheerful","generous","serious","brave","funny","nice","friendly","kind","mean","grumpy","happy","sad"
1010 DATA "big","small","heavy","short","tall","light","wide","narrow","enormous","tiny","miniature","soft","hard","smooth","sticky","thick","crisp","dry","wet","firm","crunchy","old","antique","new"
REM Cryptic nouns
REM 75 tokens
2000 DATA "occasion","regime","cosmos","spirit","dwelling","attache","arrangement","assembly","pursuit","clique","learning","evidence","treasure","dusk","fluid","kindred","visage","ether","region","conclave","lodging","combat","throughway"
2010 DATA "appointment","organism","folio","edge","municipality","concept","avail","dawn","bureau","antiquity","inquiry","concept","nature","parchment","digit","acquaintance","murmur","theatre","luminosity","representation","ward","melody"
2020 DATA "harmony","meadow","accolade","lounge","merriment","strand","symbol","agreement","inferno","incandescence","rapport","record","solstice","cultivation","culture","leaf","event","appearance","amphibian","grease","specialist","crag"
2030 DATA "presentation","aperture","grocer","sonance","earth","steed","frost","emanation"
https://basiclang.solarpunk.au/d/6-game-oats-for-my-goats/12
Trying to think where to go from here.
The point of the game will be to collect oats in the fields, and then 'spend' them at the shop.
I think the only function that the shop will serve is to purchase randomly named items for some number of oats.
At the moment what I am able to do is read two strings and print them in a fancy fashion one after the other on the screen.
It may be that all I have to do is concatenate an adjective + noun into a single string, and then store that within an inventory. What would that look like?
ITEM$ = ADJECTIVE$ + NOUN$
Which is derived from:
RESTORE INT(RND(50))+1
READ ADJECTIVE$
RESTORE INT(RND(75))+50
READ NOUN$
From here, I will have to come up with some sort of inventory system. I am not quite sure right now how I am going to do that. Doing this:
DIM INVENTORY$(10)
Initialises a string of length 10 bytes. It does not initialise an array of strings. Here perhaps we are coming up against the limits of Tiny BASIC, but, we will persist...
I have finished writing a simple random item generator for the shop component of the game.
I originally wanted to have a much more complex process.
You will be able to see much of my noodling on this in the git repo:
https://git.sr.ht/~vidak/oats-for-my-goats
5 CLS
10 PRINT "WELCOME TO THE RANDOM ITEM NAME GENERATOR."
20 PRINT "BY VIDAK."
30 PRINT "PUBLIC DOMAIN LICENCE."
40 PRINT:PRINT:PRINT
50 PRINT "HOW MANY RANDOM ITEM NAMES WOULD YOU LIKE? (0=QUIT)"
60 INPUT "> ";N
70 IF N=0 THEN END
80 FOR I = 1 TO N
90 PRINT I;TAB(5);
100 R=INT(RND(50))+1
110 RESTORE R
120 READ J$
130 PRINT J$;" ";
140 R=INT(RND(75))+50
150 RESTORE R
160 READ J$
170 PRINT J$
180 PRINT
190 NEXT I
200 PRINT
210 PRINT "DONE"
REM Adjectives
REM 50 tokens
1000 DATA "good","bad","great","horrible","perfect","beautiful","simple","handsome","gorgeous","plain","cute","messy","fancy","pretty","cheerful","generous","serious","brave","funny","nice","friendly","kind","mean","grumpy","happy","sad"
1010 DATA "big","small","heavy","short","tall","light","wide","narrow","enormous","tiny","miniature","soft","hard","smooth","sticky","thick","crisp","dry","wet","firm","crunchy","old","antique","new"
REM Cryptic nouns
REM 75 tokens
2000 DATA "occasion","regime","cosmos","spirit","dwelling","attache","arrangement","assembly","pursuit","clique","learning","evidence","treasure","dusk","fluid","kindred","visage","ether","region","conclave","lodging","combat","throughway"
2010 DATA "appointment","organism","folio","edge","municipality","concept","avail","dawn","bureau","antiquity","inquiry","concept","nature","parchment","digit","acquaintance","murmur","theatre","luminousity","representation","ward","melody"
2020 DATA "harmony","meadow","accolade","lounge","merriment","strand","symbol","agreement","inferno","incandescence","rapport","record","solstice","cultivation","culture","leaf","event","appearance","amphibian","grease","specialist","crag"
2030 DATA "presentation","aperture","grocer","sonance","earth","steed","frost","emination"
been working on the shop component of the game--where you sell the oats you have collected in the 'action' part of the game.
this little bit of code will generate a random sequence of 1, 2, or 3 adjectives to place before an English noun.
REM Word order for English adjectives for the purpose of this
REM game:
REM
REM Y 1 2 3 4 5 6
REM Quantity Opinion Size Age Shape Colour Material Noun
- 1 ... generate 3 unique random numbers between 1 and 6
5 W=INT(RND(3))+1
10 DIM H(3)
20 H(1)=INT(RND(6))+1
25 IF H(1)=6 THEN W=1: PRINT "W=";W: GOTO 70
30 FOR I=2 TO 3
40 H(I)=INT(RND(6))+1
45 IF H(2)=6 THEN W=2: PRINT "W=";W: GOTO 70
50 IF H(I)=<H(I-1) THEN GOTO 40
60 NEXT I
70 FOR I=1 TO 3
80 PRINT "H(";I;")= ";H(I)
90 NEXT I
100 PRINT "W=";W
this bit of code will produce a random subjective adjective from a list of 28.
10 J=INT(RND(28))+1
20 RESTORE J
30 READ K$
40 PRINT K$
50 DATA "good","bad","great","horrible","perfect","beautiful","ugly","simple","bald","handsome","gorgeous","plain","cute","messy","fancy","pretty","cheerful","generous","serious","brave","funny","nice","friendly","kind","mean","grumpy","happy","sad"
the idea is that the random sequence of adjectives will switch into each type of adjective subroutine to create a list of randomly named items, which the user will be able to buy in the shop.
https://spectra.video/w/jvves1Y5zC7f7uZpqETm4x
streaming right now.
working on the shop component of oats.
https://basiclang.solarpunk.au/d/6-game-oats-for-my-goats/6
the game as it stands.
as you can see, i have applied the improvements that mdhughes suggested.
for your information, the licence for the code is public domain.
> LIST
1 REM VARIABLES DEFINITION
2 DIM A(10,20)
3 DIM E(21): DIM F(21)
4 DIM P(9): DIM Q(9)
5 FOR I=1 TO 9
6 READ Q(I),P(I)
7 NEXT I
8 DATA -1,1, 0,1, 1,1, -1,0, 0,0, 1,0, -1,-1, 0,-1, 1,-1
9 REM SET UP PLAYFIELD BORDER
10 FOR B=1 TO 10
20 FOR C=1 TO 20
30 LET A(B,C)=0 REM Make every playfield space blank.
40 IF B=1 THEN A(B,C)=1 REM Top border is all fences.
50 IF B=10 THEN A(B,C)=1 REM Bottom border is all fences.
60 IF C=1 THEN A(B,C)=1 REM Left border, all fences.
70 IF C=20 THEN A(B,C)=1 REM Right border, all fences.
80 NEXT C
90 NEXT B
499 REM GENERATE PLAYER POSITION
500 B=INT(RND(8)+2)
510 C=INT(RND(18)+2)
520 A(B,C)=3
530 E(6)=B
540 F(6)=C
599 REM GENERATE POSITIONS OF OATS
600 FOR D=1 TO 5
610 B=INT(RND(8)+2)
620 C=INT(RND(18)+2)
630 IF A(B,C)<>0 THEN GOTO 610 REM IF NOT BLANK RNG AGAIN
640 A(B,C)=2 REM ELEMENT IS AN OAT~
650 E(D)=B
660 F(D)=C
670 NEXT D
999 REM PRINT MAZE PATTERN
1000 FOR B=1 TO 10
1010 FOR C=1 TO 20
1020 IF A(B,C)=0 THEN PRINT ".";
1030 IF A(B,C)=1 THEN PRINT "X";
1040 IF A(B,C)=2 THEN PRINT "ø";
1050 IF A(B,C)=3 THEN PRINT "@";
1060 NEXT C
1070 PRINT
1080 NEXT B
1090 PRINT
1100 PRINT "PLAYER POSITION: ";E(6);" x ";F(6)
1110 PRINT "OATS COLLECTED: ";G
1999 REM MAKE MOVE
2000 B=E(6)
2010 C=F(6)
2020 A(B,C)=0 REM SET PLAYER ARRAY ELEMENT TO A BLANK.
2030 INPUT I
2040 PRINT "DELTA ";P(I);" , ";Q(I)
2050 B=B+P(I)
2060 C=C+Q(I)
2999 REM RESULT CALCULATION
3000 IF A(B,C)=1 GOTO 4000 REM PLAYER TOUCHED A FENCE
3010 IF A(B,C)=2 GOTO 5000 REM PLAYER TOUCHED AN OAT
3020 E(6)=B
3030 F(6)=C
3040 A(B,C)=3
3050 GOTO 1000
4000 PRINT "YOU TOUCHED A FENCE!"
4010 A(B,C)=1 REM SET PLAYFIELD CELL BACK TO FENCE
4020 B=E(6)
4030 C=F(6) REM RETURN PLAYER TO FORMER ARRAY POSITION
4040 A(B,C)=3
4050 GOTO 1000
5000 PRINT "YOU COLLECTED AN OAT!"
5010 A(B,C)=3 REM SET PLAYFIELD CELL BACK TO PLAYER.
5020 E(6)=B REM NEW YCOORDS
5030 F(6)=C REM NEW XCOORDS
5040 G=G+1
5050 GOTO 1000
Been thinking about another game to make. This time--
"Fast Travel: The Game"
Where you press F to fast travel and collect things in the locations you teleport into.
Items collected can be converted to other items.
Users define the conversion rates upon discovering a new item that remain static for the duration of the game.
"99 oats per 3.9 blahaj".
"57 flowers to the oat".
Maybe the point of the game is to get 10 000 of something, such as oats.
René Bauer from @chludens and colleagues wrote a #BASIC #game which should run on all common #homecomputer platforms:
https://research.swissdigitization.ch/?p=1260
I will try and test/extend it for more systems and find out a routine that auto-detects on which platform it runs.
- randomly generate 5 different items
- come up with a simple randomly generated naming scheme
- name those five items with that subroutine
- add the items to the inventory once collected by the player
- once all the items are collected generate a new playfield
- the inventory list persists, the point of playing is to generate items with silly names