smallbasic - What does this VB code mean? -


filename = ".\characters.txt" loadcharacters()  while menuoption <> "x"   textwindow.write("menu : (a) adjust characters, (v) view   characters, (x) exit, (c) create character : ")   menuoption = textwindow.read()   menuoption = text.converttolowercase(menuoption)   if menuoption = "a"     textwindow.writeline("adjusting characters")     adjustcharacters()   endif      if menuoption = "v"     textwindow.writeline("viewing characters")     viewcharacters()   endif    if menuoption = "x"     textwindow.writeline("exiting program")     program.delay(500)     program.end()   endif    if menuoption = "c"     textwindow.writeline("creating characters")     createcharacter()   endif endwhile  '================================================ 'c:  sub createcharacter   textwindow.writeline("please enter number of   characters want")   characternum = textwindow.readnumber()     x = 1 characternum     textwindow.writeline("please enter name of   character" + x)     character[x] = textwindow.read()     strength[x] = 10     skill[x] = 10   endfor   adjustcharacters() endsub   '================================================ 'a:  sub adjustcharacters   x = 1 characternum     strength[x] = strength[x] + math.floor  (math.getrandomnumber(12)/math.getrandomnumber(4))     skill[x] = skill[x] + math.floor(math.getrandomnumber  (12)/math.getrandomnumber(4))   endfor   savecharacters() endsub  '================================================ 'v:  sub viewcharacters   x = 1 characternum     textwindow.writeline("character " + x + " - " +   character[x] + ", stength = " + strength[x] + ", skill = "   + skill[x])   endfor endsub  '================================================  sub loadcharacters   ' requires filename set   characternum = file.readline(filename,1)   textwindow.writeline("number of characters = " +   characternum)   x = 1 characternum     character[x] = file.readline(filename,x * 3 - 1) '   name     strength[x] = file.readline(filename,x * 3) '   strength     skill[x] = file.readline(filename,x * 3 + 1) '   skill   endfor endsub  '================================================  sub savecharacters   ' requires filename , totalcharacters set   file.writeline(filename,1,characternum)   x = 1 characternum     file.writeline(filename,x * 3 - 1,character[x]) ' set   name     file.writeline(filename,x * 3, strength[x]) ' set   strength     file.writeline(filename,x * 3 + 1, skill[x]) ' set   skill   endfor     endsub   

really stuck on , need head round it. in small basic , have teach kids how write in pseudo code. if explain code used it'd appreciated.

cheers

it's part of game, player presented menu create, adjust , view game characters. createcharacter asks player names of characters, adjust characters gives charactes random strength , skill points, save characters writes characters file, load loads them file , puts them in memory, view characters prints character names , stats on screen.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -