DEFINE STRING COUNT 64 DEFINE STRING SPACE 512 CONST maxoptions=8 CONST optionsy=3 DIM availableoptions(maxoptions) GLOBAL charPoints GLOBAL optionspointer GLOBAL xlocation GLOBAL ylocation DIM options$(maxoptions) DIM r$(3,3) r$(0,0)="north of the base entrance" r$(0,1)="outside the base entrance" r$(0,2)="south of the base entrance" r$(1,0)="nw" r$(1,1)="base entrance" r$(1,2)="sw" r$(2,0)="ne" r$(2,1)="e" r$(2,2)="se" DIM lockeddoors$(3,3) DIM exits$(3,3) DIM encounters(3,3) DIM encountername$(7,10) DIM encounterstr(7,10) DIM partystr(9) DIM partyskill(9) GLOBAL charisma PROCEDURE initGame SHARED lockeddoors SHARED exits SHARED encounters SHARED encountername SHARED encounterstr SHARED partystr SHARED partyskill charPoints=15 partystr(0)=3 partyskill(0)=3 charisma=3 xlocation=0 ylocation=1 ' lockeddoors$(0,0)="" lockeddoors$(0,1)="e" ' lockeddoors$(1,2)="" ' lockeddoors$(1,0)="" ' lockeddoors$(1,1)="" ' lockeddoors$(1,2)="" ' lockeddoors$(2,0)="" ' lockeddoors$(2,1)="" ' lockeddoors$(2,2)="" exits$(0,0)="s" exits$(0,1)="esn" exits$(0,2)="n" exits$(1,0)="se" exits$(1,1)="wens" exits$(1,2)="ne" exits$(2,0)="sw" exits$(2,1)="wns" exits$(2,2)="wn" encounters(1,2)=1 encountername$(1,1)="Protestor" encountername$(1,2)="Protestor" encountername$(1,3)="Protestor" encountername$(1,4)="Protestor" encountername$(1,5)="Protestor" encountername$(1,6)="Protestor" encounterstr(1,1)=4 encounterstr(1,2)=4 encounterstr(1,3)=4 encounterstr(1,4)=3 encounterstr(1,5)=4 encounterstr(1,6)=4 END PROC initGame[] PROCEDURE printPointer FOR c=1 TO maxoptions LOCATE 0,optionsy+c PRINT " " NEXT LOCATE 0,optionsy+optionspointer PRINT ">" END PROC PROCEDURE printOptions SHARED availableoptions SHARED options FOR c=1 TO maxoptions IF availableoptions(c)=1 THEN LOCATE 1,optionsy+c PRINT options$(c) ENDIF NEXT END PROC PROCEDURE resetOptions FOR c=1 TO maxoptions availableoptions(c)=0 options$(c)="" NEXT END PROC PROCEDURE optionsdown FOR c=1 TO maxoptions optionspointer=optionspointer+1 IF optionspointer>maxoptions THEN optionspointer=1 ENDIF IF availableoptions(optionspointer)=1 THEN RETURN ENDIF NEXT END PROC PROCEDURE optionsup done=0 FOR c=1 TO maxoptions optionspointer=optionspointer-1 IF optionspointer<1 THEN optionspointer=maxoptions ENDIF IF availableoptions(optionspointer)=1 THEN RETURN ENDIF NEXT END PROC PROCEDURE updatedecide[l$] IF l$="q" THEN optionsup[] printPointer[] ENDIF IF l$="a" THEN optionsdown[] printPointer[] ENDIF END PROC PROCEDURE reprintCreateCharacterScreen FOR c =1 TO maxoptions IF options$(c)="Strength" THEN LOCATE 11,optionsy+c PRINT " " LOCATE 11,optionsy+c PRINT partystr(0) ENDIF IF options$(c)="Skill" THEN LOCATE 7,optionsy+c PRINT " " LOCATE 7,optionsy+c PRINT partyskill(0) ENDIF IF options$(c)="Charisma" THEN LOCATE 11,optionsy+c PRINT " " LOCATE 11,optionsy+c PRINT charisma ENDIF NEXT LOCATE 18,18 PRINT " " LOCATE 18,18 PRINT charPoints END PROC PROCEDURE initCharScreen CLS SHARED availableoptions SHARED options$ LOCATE 0,0 resetOptions[] optionspointer=2 PRINT "distribute points between" PRINT "strength,skill and charisma." LOCATE 0,18 charPoints=15 PRINT "char points left:" availableoptions(2)=1 availableoptions(4)=1 availableoptions(6)=1 options$(2)="Strength" options$(4)="Skill" options$(6)="Charisma" printOptions[] printPointer[] reprintCreateCharacterScreen[] END PROC PROCEDURE spendcharpoint charPoints=charPoints-1 IF options$(optionspointer)="Strength" THEN partystr(0)=partystr(0)+1 ENDIF IF options$(optionspointer)="Skill" THEN partyskill(0)=partyskill(0)+1 ENDIF IF options$(optionspointer)="Charisma" THEN charisma=charisma+1 ENDIF reprintCreateCharacterScreen[] END PROC PROCEDURE retractcharpoint IF options$(optionspointer)="Strength" AND partystr(0)>3 THEN partystr(0)=partystr(0)-1 charPoints=charPoints+1 ENDIF IF options$(optionspointer)="Skill" AND partyskill(0)>3 THEN partyskill(0)=partyskill(0)-1 charPoints=charPoints+1 ENDIF IF options$(optionspointer)="Charisma" AND charisma>3 THEN charisma=charisma-1 charPoints=charPoints+1 ENDIF reprintCreateCharacterScreen[] END PROC CONST createcharmode=1 CONST adventurMode=2 GLOBAL gamemode gamemode=createcharmode PROCEDURE printAdventureScreen SHARED r$ SHARED availableoptions SHARED options$ SHARED exits$ CLS LOCATE 0,0 PRINT r$(xlocation,ylocation) PRINT exits$(xlocation,ylocation) PRINT MID(exits$(xlocation,ylocation),1,1) PRINT MID(exits$(xlocation,ylocation),2,1) PRINT MID(exits$(xlocation,ylocation),3,1) FOR c=0 TO 3 IF MID(exits$(xlocation, ylocation),c,1)="n" THEN options$(1)="Move North" :availableoptions(1)=1 ENDIF IF MID(exits$(xlocation,ylocation),c,1)="e" THEN options$(2)="Move East":availableoptions(2)=1 ENDIF IF MID(exits$(xlocation, ylocation),c,1)="s" THEN options$(3)="Move South":availableoptions(3)=1 ENDIF IF MID(exits$(xlocation,ylocation),c)="w" THEN options$(4)="Move West":availableoptions(4)=1 ENDIF NEXT printOptions[] END PROC PROCEDURE initAdventurMode resetOptions[] gamemode=adventurMode printAdventureScreen[] END PROC PROCEDURE updateCreateCharMode[l$] IF l$="p" AND charPoints>0 THEN spendcharpoint[] ENDIF IF l$="o" THEN retractcharpoint[] ENDIF IF l$=" " THEN initAdventurMode[] ENDIF END PROC PROCEDURE updateAdventurMode END PROC initCharScreen[] WHILE 1 k$=INKEY$ updatedecide[k$] IF gamemode=createcharmode THEN updateCreateCharMode[k$] ENDIF IF gamemode=adventurMode THEN updateAdventurMode[] ENDIF WEND
The instructions here refer to compiling the example from the command line. For Microsoft Windows users we suggest using UGBASIC-IDE, which allows you to compile the example with just one click.
In order to compile and run the example, you need to have the Altirra emulator, and in particular that the altirra
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.atari bug447.bas -o example.xex altirra example.xex # Windows ugbc.atari.exe bug447.bas -o example.xex altirra example.xex
In order to compile and run the example, you need to have the Altirra emulator, and in particular that the altirra
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.atarixl bug447.bas -o example.xex altirra example.xex # Windows ugbc.atarixl.exe bug447.bas -o example.xex altirra example.xex
In order to compile and run the example, you need to have the VICE emulator, and in particular that the x64sc
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.c64 bug447.bas -o example.prg x64sc example.prg # Windows ugbc.c64.exe bug447.bas -o example.prg x64sc example.prg
In order to run the example, you need to have the YAPE emulator. In particular that the yape
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.plus4 bug447.bas -o example.prg yape example.prg # Windows ugbc.plus4.exe bug447.bas -o example.prg yape example.prg
In order to run the example, you need to have the VICE emulator. In particular that the xplus4
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.plus4 bug447.bas -o example.prg xplus4 example.prg # Windows ugbc.plus4.exe bug447.bas -o example.prg xplus4 example.prg
In order to compile and run the example, you need to have the XROAR emulator, and in particular that the xroar
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.d32 bug447.bas -o example.bin xroar -rompath (your rom path) example.bin # Windows ugbc.d32.exe bug447.bas -o example.bin xroar.exe -rompath (your rom path) example.bin
In order to compile and run the example, you need to have the XROAR emulator, and in particular that the xroar
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.d64 bug447.bas -o example.bin xroar -rompath (your rom path) example.bin # Windows ugbc.d64.exe bug447.bas -o example.bin xroar.exe -rompath (your rom path) example.bin
In order to compile and run the example, you need to have the DCMOTO emulator, and in particular that the dcmoto
executable is accessible.
Then, type this command on the command line and on the emulator:
# Linux ugbc.pc128op bug447.bas -o example.k7 dcmoto (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC # Windows ugbc.pc128op.exe bug447.bas -o example.k7 dcmoto (choose example.k7) (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC
In order to compile and run the example, you need to have the DCMOTO emulator, and in particular that the dcmoto
executable is accessible.
Then, type this command on the command line and on the emulator:
# Linux ugbc.pc128op bug447.bas -o example.k7 dcmoto (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC # Windows ugbc.pc128op.exe bug447.bas -o example.k7 dcmoto (choose example.k7) (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC
In order to compile and run the example, you need to have the VICE emulator, and in particular that the xvic
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.vic20 bug447.bas -o example.prg xvic --memory 24k example.prg # Windows ugbc.vic20.exe bug447.bas -o example.prg xvic --memory 24k example.prg
In order to compile and run the example, you need to have the Speccy emulator, and in particular that the speccy
executable is accessible.
Then, type this command on the command line:
# Linux ugbc.zx bug447.bas -o example.tap Speccy example.tap # Windows ugbc.zx.exe bug447.bas -o example.tap Speccy example.tap
In order to compile and run the example, you need to have the openMsx or the BlueMSX emulator, and in particular that its executable is accessible.
Then, type this command on the command line:
# Linux ugbc.msx1 bug447.bas -o example.rom openmsx -cart example.rom # Windows ugbc.msx1.exe bug447.bas -o example.rom openmsx -cart example.rom
# Linux ugbc.msx1 bug447.bas -o example.rom bluemsx example.rom # Windows ugbc.msx1.exe bug447.bas -o example.rom bluemsx example.rom
In order to compile and run the example, you need to have the openMsx or the BlueMSX emulator, and in particular that its executable is accessible.
Then, type this command on the command line:
# Linux ugbc.coleco bug447.bas -o example.rom openmsx -machine \"COL - ColecoVision\" -cart example.rom # Windows ugbc.coleco.exe bug447.bas -o example.rom bluemsx -machine \"COL - ColecoVision\" example.rom
# Linux ugbc.coleco bug447.bas -o example.rom bluemsx /machine \"COL - ColecoVision\" /rom1 example.rom # Windows ugbc.coleco.exe bug447.bas -o example.rom bluemsx /machine \"COL - ColecoVision\" /rom1 example.rom
In order to compile and run the example, you need to have the BlueMSX emulator, and in particular that its executable is accessible.
Then, type this command on the command line:
# Linux ugbc.sc3000 bug447.bas -o example.rom bluemsx /machine \"SEGA - SC-3000\" /rom1 example.rom # Windows ugbc.sc3000.exe bug447.bas -o example.rom bluemsx /machine \"SEGA - SC-3000\" /rom1 example.rom
In order to compile and run the example, you need to have the BlueMSX emulator, and in particular that its executable is accessible.
Then, type this command on the command line:
# Linux ugbc.sg1000 bug447.bas -o example.rom bluemsx /machine \"SEGA - SG-1000\" /rom1 example.rom # Windows ugbc.sg1000.exe bug447.bas -o example.rom bluemsx /machine \"SEGA - SG-1000\" /rom1 example.rom
If you have found a problem trying to run this example, if you think there is a bug or, more simply, you would like it to be improved, open an issue for this example on GitHub. Thank you!