This guide helps you make a basic makeshift database. You can include various items such as rooms. You can also add custom types for things like bank accounts and tasks.
Application of Code
To speed things up, tweak the computer speed and make sure the database computer can run endlessly. Use a screwdriver with the Screwdriver Code to adjust both the database computer (preferably the one with the memory API) and the workstation computer in the Police Station, specifically the yellow-screened one with the GetAllRooms function. The corner computer with the red screen also has the memory API, making it a convenient choice.
After adjusting both computers, hack into the database computer, the one with the memory API or save/load memory functions. Take the Database Code from this guide and apply it to the computer. Compile the code and close the interface. You’ll observe the code running on the screen.
Now, hack into the yellow-screened workstation and apply the Workstation Code to it.
Currently, there’s a basic demonstration. Work is still in progress to create a menu with options for slurping, relocating, and parsing coordinates. Pressing enter with no input will scroll through the lists.
Screwdriver Code
SetMhz(500) SetMaxTime(-2)
Database Code
############################################## # Main Custom Functions #--------------------------------------------- #array GetItems(string type) #array GetTypes() #bool Save(string type,string name) ############################################## #Helper - For initial database setup Auto'd by Save() void createTypes() bool test = HasMemory('Types') if !test SaveMemory('Types',0) end end #Helper - Test blank input bool inputBlank(var test) if test == "" return True else return False end end #Helper - Check if database information has been imported void Setup() bool testDB = HasMemory('Database') if !testDB ClearText() Print("Database has not been built") Print("Running now...") Sleep(4) BuildDatabase() end end #Saves items to database bool Save(string type,string name) bool test = HasMemory(type) number qty number typesQty bool testTypes = HasMemory('Types') if inputBlank(type) return false end if inputBlank(name) return false end if testTypes else createTypes() end if test qty = LoadMemory(type) qty++ SaveMemory(type,qty) else typesQty = LoadMemory('Types') typesQty++ SaveMemory('Types' + typesQty,type) SaveMemory('Types',typesQty) qty = 1 SaveMemory(type,qty) end SaveMemory(type + qty,name) Print(type + qty) return true end #testing input function void fun() loop var typ = Input(':') if inputBlank(typ) return end if typ == 'exit' break end Save(typ,'name') Print(LoadMemory('Types') + ":Number of Types") end end #returns all types of items in database array GetTypes() array build number cnt = 1 string tem loop tem = 'Types' + cnt if HasMemory(tem) Append(build,LoadMemory(tem)) else return build end cnt++ end end #Returns all items of supplied type array GetItems(string type) number cnt = 1 array build string tem if inputBlank(type) return end bool available = HasMemory(type) if !available return end bool test loop tem = type + cnt test = HasMemory(tem) if test Append(build,LoadMemory(tem)) cnt++ else return build end end end #Helper - var PoliceAdmin() string computer = "PoliceOfficeInterior_MinistryOfficeWorkstationComputer_1" var con = Connect(computer) return con end #Helper - Builds database void BuildDatabase() array items string type bool saved var con = PoliceAdmin() array rooms = con.GetAllRooms() ClearMemories() ClearText() loop room in rooms type = "room" saved = Save(type,room) items = con.GetThingsInRoom(room) loop item in items type = con.GetTypeOfThing(item) saved = Save(type,item) end end ClearText() SaveMemory('Database',1) Print("Database Information Imported") end #Helper - void bar() Print("--------------------") end #Helper - Show and Select from an array var Select(array arr) number track number select number incr loop track = 0 select = 0 incr = 0 loop x from 0 to Count(arr) - 1 track++ incr++ Print(incr + ":" + arr[x]) if track == 5 track = 0 select = sel() ClearText() if select > -1 return arr[select] else if select == -2 break end end end end end #Helper to select() - Determine if number and return number sel() bool isNum string testNum loop isNum = true bar() testNum = Input(":>") if testNum == "0" isNum = false else if testNum == "" #Move Forward return -1 else if testNum == " " #Move Back return -2 else if testNum == "menu" or testNum == "exit" #return to menu return -3 end loop testNum if CharToInt(@) < -49 or CharToInt(@) > -40 isNum = false break end end if isNum == true break end end number num = testNum num-- return num end ############################################## Setup()
WorkStation Code
#Helper - var PoliceMem() var con = Connect("PoliceOfficeInterior_TriPodComputer_TriPodComputer_1") return con end #Helper - void title(string title, number max) Print(max + ": " + title) bar(2) end void bar(number t) if t == 2 Print("--------------------") else if t == 1 Print("====================") end end #Helper - Show and Select from an array var Select(array arr) number track number select number incr loop track = 0 select = 0 incr = 0 loop x from 0 to Count(arr) - 1 track++ incr++ Print(incr + ":" + arr[x]) if track == 5 track = 0 select = sel() ClearText() if select > -1 return arr[select] else if select == -2 break end end end end end #Helper to select() - Determine if number and return # Old select function.. need to revise or replace number sel() bool isNum string testNum loop isNum = true bar(1) testNum = Input(":>") #if testNum == "0" # isNum = false if testNum == "" #Move Forward return -1 else if testNum == " " #Move Back return -2 else if testNum == "menu" or testNum == "exit" #return to menu return -3 end loop testNum if CharToInt(@) < -49 or CharToInt(@) > -40 isNum = false break end end if isNum == true break end end number num = testNum num-- return num end # Old selectitem function.. need to revise or replace string SelectItem() var con = PoliceMem() array types = con.GetTypes() string type = Select(types) array items = con.GetItems(type) string it = Select(items) return it end # void Position() string name = SelectItem() string target = "PoliceOfficeInterior_Diskette_Diskette6_1" SetPosition(name,target) end # string GetPName(string name) bool grab = false string Pname = GetPosition(name) string get = "" loop Pname if @ == " " grab = true else if @ == "," break else if grab == true get += @ end end return get end # string GetPCoor(string name) bool grab = false string Pname = GetPosition(name) string get loop Pname if @ == "(" grab = true else if @ == ")" break else if grab == true get += @ end end return get end string NewSelection(array myarr,string titl) number count = Count(myarr) number cnt = 1 number res loop ClearText() title(titl,count) if (cnt + 4) < count loop x from cnt to (cnt +4) Print(x + ". " + myarr[x - 1]) end cnt += 5 else loop x from cnt to count Print(x + ". " + myarr[x - 1]) end cnt = 1 end res = sel() if res > -1 return myarr[res] end end end ############################################## # PoliceMem #--------------------------------------------- #array GetItems(string type) #array GetTypes() #bool Save(string type,string name) # #GetMemories #HasMemory() #ClearMemories #EraseMemory( #SaveMemory( #LoadMemory( ############################################## # Workstation #--------------------------------------------- #string GetPCoor(string name) #string GetPName(string name) #void Position() #Sets position of targets item #string SelectItem() #runs item selection process #void title(string title, number max) # #GetPeople() #GetThingsOfType() #GetPosition() #GetAction() #GetRoom() #GetThingsInRoom() #GetAllRooms() #GetTypeOfThing() #InteractWith() #IsKeyPressed() #SetPosition() ############################################## # Run Below ############################################## var con = PoliceMem() string type = NewSelection(con.GetTypes(),'Types') string item = NewSelection(con.GetItems(type),type+'s')
That's everything we are sharing today for this Else Heart.Break() guide. This guide was originally created and written by KnustSinn. In case we fail to update this guide, you can find the latest update by following this link.