Else Heart.Break()

Else Heart.Break()

deps Sep 26, 2015 @ 12:59pm
Floppy Copy Program I Made (Show your creations here! Spoilers!!)
Edit: Be warned that there might be spoilers in the code posted in this thread!
Proceed with caution!



I made a floppy copier. I am not that far into the game so I don't know if this will even be useful, but I had fun creating it.

Paste code into a computer with a screen and memory module.
Use the computer with the floppy you want to copy and select "r".
Then switch to a floppy you want to write the first one to and select "w".

(I was not aware that you could Ctrl+C & V the code when I wrote it)

# Floppy copier 1.0 # Requires screen and memory module ClearText() if HasFloppy() == false Print("Insert disk...") Quit() end loop ClearText() Print("Read disk to memory or") Print("Write memory to floppy?") string cmd = Input("r/w: ") if cmd == "r" or cmd == "R" readDisk() else if cmd == "w" or cmd == "W" writeDisk() else Print("Unknown command...") Sleep(3) end end void readDisk() Print("Reading disk...") number lines = 0 loop line in LoadData() PrintS(".") SaveMemory("line_"+lines, line) lines++ end Print("") SaveMemory("disk_lines", lines) Print("Done!") Sleep(2) end void writeDisk() number lines = LoadMemory("disk_lines") Print("Writing to disk!") Print("Will write " + lines + " lines to disk.") string ok = Input("Are you sure? (y/n) ") if ok == "y" or ok == "Y" Print("Formatting disk...") ClearData() PrintS("Writing to disk") loop from 0 to lines string line = LoadMemory("line_"+@) SaveData( line ) PrintS(".") end Print("") Print("Done!") Sleep(2) else Print("Aborted!") Sleep(2) end end
Last edited by deps; Sep 28, 2015 @ 10:14am
< >
Showing 1-15 of 22 comments
9214 Sep 26, 2015 @ 1:13pm 
Seems like Ctrl+C Ctrl+V crutch, but it's great practice anyway! :f2_happy:
Here's my brutforce key code, seems to work on most of doors in game, overwise it's just crazy to create bigger loop for codes > 9999:

# HackSistahPlusOne loop x from 1 to 9999 if Unlock(x) number codeMinusOne = x - 1 Lock(x) # Code from that door is last invalid code plus one! I'll show ya now loop y from 1 to 200 Unlock(codeMinusOne) end Unlock(x) break end end

# LittleSistah loop x from 1 to 9999 if Unlock(x) break end end


Maybe we should create a thread for code-sharing?
Last edited by 9214; Sep 26, 2015 @ 1:59pm
deps Sep 26, 2015 @ 2:46pm 
Let's turn this one into a code sharing bazaar! :)
I found your LittleSistah very useful! Thanks a bunch!
KWERk Sep 26, 2015 @ 3:09pm 
deps: you might want to remember to clear the memory (ClearMemories()) after the first floppy, or that memory will always be on that machine. You could also save floppy contents into meta-variables that increment to indicate sizes (I'm currently working on an in-game database that stores all the names I come across and allows me to make aliases for them - tough when there's basically only a single key-value system, but whatevs).
e.g.:
SaveMemory("floppy_"+LoadMemory("NumberOfFloppies")+"_"+curLineNumber, floppyLineData) SaveMemory("NumberOfFloppies", LoadMemory("NumberOfFloppies") + 1) SaveMemory("floppy_"+LoadMemory("NumberOfFloppies")+"_numLines", numLines)

This way, you'd have access to all the floppies you use on that machine, and iteration isn't too bad through the database. You could even export from other machines via Internet and RemoteFunction calls...
Last edited by KWERk; Sep 26, 2015 @ 3:20pm
KWERk Sep 26, 2015 @ 3:20pm 
Why do I get the feeling that actual floppy capacity will be tested by users in this game? And have the floppies been coded to be that realistic?
deps Sep 27, 2015 @ 2:54am 
The problem with ClearMemories is that it will wipe out everything. I had 99% of a clearMemory method done before I realised there is no way to clear one memory. a EraseMemory( string key ) would be lovely.

Your database looks interesting!
Erik Sep 27, 2015 @ 4:06am 
I'll add a EraseMemory function in the next release.
deps Sep 27, 2015 @ 4:40am 
Thanks!
There is no way to query a computer for available commands, right?
If there could be an HasFunction( string functionName ) function, on all computers, that returns true or false then that would be great! :)
My program up there could for example show an error message if the memory or floppy functions is not available.
Erik Sep 27, 2015 @ 5:40am 
No, but that's an easy addition also.
Asgeir Sep 27, 2015 @ 1:04pm 
Here is my command toolkit. Assembled by reading the help on the relevant machines.

ClearText() PlaySound("Coin 1") PrintBar() Print("Seb OS 1.0") Print("* * * * * *") Print(Name()) PrintBar() var hugin = Connect("Hugin") var mainframe = Connect("MainFrame") var meteorology = Connect("MeteorologyServer") var power = Connect("PowerTap") loop ResetConnections() var command = Input("> ") DispatchCommand(command) end void ResetConnections() DisconnectAll() hugin = Connect("Hugin") mainframe = Connect("MainFrame") meteorology = Connect("MeteorologyServer") power = Connect("PowerTap") end void DispatchCommand(string command) if command == "h" or command == "H" or command == "?" or command == "help" Print("cls - Clear Screen") Print("cm - Command Person") Print("dc - Door Control") Print("lp - List People") Print("lr - List Rooms") Print("mv - Set Position") Print("ps - Person Status") Print("rc - Room Contents") Print("wg - Get Weather") Print("ws - Set Weather") else if command == "cls" ClearText() else if command == "cm" string person = Input("Enter name of person: ") string item = Input("Enter name of item to interact with: ") mainframe.InteractWith(person, item) else if command == "dc" string doorName = Input("Enter the name of the door you wish to control: ") var door = Connect(doorName) if door < 0 Print("Unable to find door") else string state = "" loop if state == "u"or state == "l" break end state = Input("Enter desired state (u/l): ") end if state == "u" hugin.UnlockByName(doorName) else hugin.LockByName(doorName) end end else if command == "lp" Print(mainframe.GetPeople()) else if command == "lr" Print(mainframe.GetAllRooms()) else if command == "mv" string name = Input("Name of thing to move: ") string target = Input("Name of target: ") mainframe.SetPosition(name, target) else if command == "ps" string person = Input("Enter name of person you want to inspect: ") Print(person) Print(" Action: " + mainframe.GetAction(person)) Print(" Room: " + mainframe.GetRoom(person)) Print(" Position: " + mainframe.GetPosition(person)) else if command == "rc" string roomName = Input("Enter name of room you want to inspect: ") Print(mainframe.GetThingsInRoom(roomName)) else if command == "wg" number rain = meteorology.GetRain() string name = "" if rain < 25 name = "Sunny" else if rain < 100 name = "Drizzle" else if rain < 200 name = "Rain" else name = "Storm" end Print("Rain (" + rain + ") - " + name) else if command == "ws" number rain = 0 loop rain = Input("Enter new weather value (0 - 200): ") if rain >= 0 and rain <= 200 break end end meteorology.SetRain(rain) end end void PrintBar() Print("===================") end
KWERk Sep 27, 2015 @ 2:36pm 
All the spoilers, Asgeir. :P Not even touching that code.
KWERk Sep 27, 2015 @ 5:21pm 
Found a hitch, but I'm not sure that it's a real problem or just my poor programming skills. I can't search strings via the array GetMemories() returns; it's a hiccup in my search-term script for quickly finding items I've saved - one of a few tools I've been building for making typical string operations in the game. :P Is this an easy fix?
Herbert Sep 27, 2015 @ 10:56pm 
Tired of typing in person, room and thing names to slurp? Wish there was some menu that provided all the options to you? I present the SlurpMenu!

Contained in the code are several helpful string functions as well as a merge sort! Who would ever use bubble when merge is around?

If you feel this needs spoiler tags, the server being used is actually one in the police office, so if you've gotten that far feel free to use this. (Warning, this program feels like a huge cheat.)

# Globals ################################################## # You may want to change this as it doesn't seem to work on all screen sizes var screenLines = Int(Height() / 19) bool gPeopleSorted = False array gPeople = [] array gPeopleAsKeys = [] # Program ################################################## loop Main() end # Control Functions ################################################## void Main() var actions = ["Find person", "Slurp"] MergeSortString(actions) array leadingText = ["Choose action", "-------------"] string action = ScreenSelect(screenLines, leadingText, actions) if action == "Find person" FindPerson() else if action == "Slurp" PickSlurp() end end var GetPeople(bool sortRequired) if Count(gPeople) == 0 var s = PersonServer() Print("Retrieving people...") gPeople = s.GetPeople() end if sortRequired == True && gPeopleSorted == False Print("Sorting people(" + Count(gPeople) + ")...") MergeSortString(gPeople) gPeopleSorted = True end return gPeople end var GetPeopleAsKeys() if Count(gPeopleAsKeys) == 0 var people = GetPeople(False) loop person in people gPeopleAsKeys[person] = 1 end end return gPeopleAsKeys end var PersonServer() # GetPeople :: [String] # GetPosition :: String -> String # "ROOMNAME, coordinate: (X,Y) # GetAction :: PersonName -> String # GetRoom :: PersonName -> String # GetThingsInRoom :: RoomName -> [String] # GetAllRooms :: [String] return Connect("PoliceOfficeInterior_MinistryOfficeWorkstationComputer_1") end void FindPerson() var s = PersonServer() array people = GetPeople(True) string person = ScreenSelect(screenLines, LeadingText("People"), people) array title = [] Append(title, "Person: " + person) Append(title, " " + s.GetPosition(person)) Append(title, " Action: " + s.GetAction(person)) Append(title, DupString(Longest(title), "-")) array actions = ["Restart", "Slurp to same room"] string action = ScreenSelect(screenLines, title, actions) if action == "Slurp to same room" SlurpToRoom(s.GetRoom(person)) end end bool IsAllowedRoom(string room) if (IsSuffixOf("_inventory", room)) return False end return True end void PickSlurp() array areas = ["BarYvonne", "BurrowsApartments", "BurrowsNorth", "Casino", "DorisGardens", "Factory", "FinanceArea", "Foley", "HarborEast", "HarborNorth", "HarborSouth", "HarborWest", "Hotel", "Internet", "Mines", "Ministry", "PixiesApartment", "Plaza", "PoliceOffice", "PoorDesolateBuilding1", "ShoeStore", "SodaStorage", "TownHall", "YulianApartment"] string area = ScreenSelect(screenLines, LeadingText("Choose area"), areas) var s = PersonServer() array rooms = s.GetAllRooms() array selectRooms = [] loop room in rooms if IsPrefixOf(area, room) && IsAllowedRoom(room) Append(selectRooms, room) end end string selectedRoom = selectRooms[0] if(Count(selectRooms) > 1) Print("Sorting rooms(" + Count(selectRooms) + ")...") MergeSortString(selectRooms) selectedRoom = ScreenSelect(screenLines, LeadingText("Choose room"), selectRooms) end SlurpToRoom(selectedRoom) end void SlurpToRoom(string selectedRoom) var s = PersonServer() ClearText() Print("Retrieving things for room " + selectedRoom) array things = s.GetThingsInRoom(selectedRoom) Print("Culling non-connectable items. (" + Count(things) + ")") array connectableThings = [] loop thing in things array peopleAsKeys = GetPeopleAsKeys() if (Connect(thing)) && HasIndex(peopleAsKeys, thing) == False Append(connectableThings, thing) end end array thingsByPrefix = [] loop thing in connectableThings thingsByPrefix[StripPrefix("____", StripPrefix(selectedRoom, thing))] = thing end array thingsByPrefixKeys = GetIndexes(thingsByPrefix) if Count(thingsByPrefixKeys) > 75 Print("Skipping sort due to too many items! (" + Count(thingsByPrefixKeys)+ ")") else Print("Sorting things(" + Count(thingsByPrefixKeys) + ")...") MergeSortString(thingsByPrefixKeys) end string selectedPrefix = ScreenSelect(screenLines, LeadingText("Choose thing in room"), thingsByPrefixKeys) string selectedThing = thingsByPrefix[selectedPrefix] DisconnectAll() var server = Connect(selectedThing) Slurp() end void ScreenSelect(number height, array niceLines, array values) number niceLinesLength = Count(niceLines) string selection number currentPage = 0 array pages = PartitionBy(height - niceLinesLength, values) number pagesLength = Count(pages) loop bool firstPage = currentPage == 0 bool lastPage = currentPage == pagesLength - 1 ClearText() loop line in niceLines Print(line) end array byLineNumber = [] var lineNumber = 1 loop line in pages[currentPage] byLineNumber[lineNumber+""] = line Print(lineNumber + ": " + line) lineNumber += 1 end selection = Input(FormatSelectionText(currentPage, pagesLength)) if (lastPage == True && selection == "") currentPage = 0 else if ((selection == "" || selection == "n") && lastPage == False) currentPage += 1 else if (firstPage == False && selection == "p") currentPage -= 1 else if (HasIndex(byLineNumber, selection)) return byLineNumber[selection] end end end string FormatSelectionText(number currentPage, number pages) bool firstPage = currentPage == 0 bool lastPage = currentPage == pages - 1 string pageDetail = "(" + (currentPage+1) + "/" + pages + ")" if(pages == 1) return "Selection: " else if(firstPage) return pageDetail + " #/n: " else if(lastPage) return pageDetail + " #/p: " else return pageDetail + " #/n/p: " end end # Helper Functions ################################################## void PartitionBy(number partionSize, array values) array ret = [] array current = [] number currentSize = 0 loop val in values currentSize = currentSize + 1 Append(current, val) if(currentSize == partionSize) Append(ret, current) current = [] currentSize = 0 end end # Get last partition if not empty if(Count(current) > 0) Append(ret, current) end return ret end var ByIndex(array arr, number index) number count = 0 loop x in arr if(count == index) return x end count = count + 1 end end # String Helper Functions ################################################## string StripPrefix(string prefix, string str) var pos = 0 loop c in prefix if c != str[pos] break end pos += 1 end string ret = "" loop i in Range(pos, Count(str) - 1) ret += str
end
return ret
end

number CompareString(string a_, string b_)
string a = ToLowerCase(a_)
string b = ToLowerCase(b_)
var aLen = Count(a)
var bLen = Count(b)

var pos = 0
loop
if pos == aLen && pos == bLen
return 0
else if pos == aLen
return -1
else if pos == bLen
return 1
else
var diff = CharToInt(a[pos]) - CharToInt(b[pos])
if diff != 0
return diff
else
pos += 1
end
end
end
end

bool IsUpperCase(var c)
return CharToInt(c) >= -32 && CharToInt(c) <= -7
end

string ToLowerCase(var text)
string res = ""
loop c in text
if IsUpperCase(c)
res += IntToChar(CharToInt(c) + 32)
else
res += c
end
end
return res
end

string DupString(number times, string str)
string ret = ""
loop i from 1 to times
ret = ret + str
end
return ret
end

array LeadingText(string title)
return [title, DupString(Count(title), "-")]
end

number Longest(array arr)
var count = 0
loop str in arr
var strCount = Count(str)
if strCount > count
count = strCount
end
end
return count
end

bool IsPrefixOf(string prefix, string str)
var prefixSize = Count(prefix)
var strSize = Count(str)
if strSize < prefixSize
return False
end
var i = 0
loop c in prefix
if c != str
return False
end
i += 1
end
return True
end

bool IsSuffixOf(string suffix, string str)
var suffixSize = Count(suffix)
var strSize = Count(str)
if strSize < suffixSize
return False
end
var difference = strSize - suffixSize
var i = 0
loop c in suffix
if c != str[i+difference]
return False
end
i += 1
end
return True
end

# Sort Functions
##################################################

void MergeSortString(array arr)
array work = []
TopDownSplitMergeString(arr, 0, Count(arr), work)
end

void TopDownSplitMergeString(array a, number iBegin, number iEnd, array b)
if(iEnd - iBegin < 2)
return
end

number iMiddle = Int((iEnd + iBegin) / 2)
TopDownSplitMergeString(a, iBegin, iMiddle, b)
TopDownSplitMergeString(a, iMiddle, iEnd, b)
TopDownMergeString(a, iBegin, iMiddle, iEnd, b)
CopyArray(b, iBegin, iEnd, a)
end

void TopDownMergeString(array a, number iBegin, number iMiddle, number iEnd, array b)
var i0 = iBegin
var i1 = iMiddle

loop j from iBegin to (iEnd - 1)
# Why split this up? "if" parameters are broken when this was written
var postCheck = i1 >= iEnd;
if postCheck == False
postCheck = CompareString(a[i0], a[i1]) < 1
end
if (i0 < iMiddle && postCheck)
b[j] = a[i0]
i0 += 1
else
b[j] = a[i1]
i1 += 1
end
end
end

void CopyArray(array b, number iBegin, number iEnd, array a)
loop k in Range(iBegin, iEnd - 1)
a[k] = b[k]
end
end[/code]
Saldek Sep 28, 2015 @ 7:16am 
Here's a copy setup that appends any floppy to a beverage of your choice. You need to first copy code to a sink and fill your drink with it once. That creates a connection between the two. Now you can use their connection to append info to your container: computer names, fusebox names, or the entire content of a floppy.

The sink code:
void appendStuff(stuff) return AppendCode(stuff) end

The floppy copy code (run on a computer with internet and floppy drive):
copyCup() void copyCup() string sinkName = "CasinoWorkerApartment1_Poor_WaterTap_Poor_WaterTap_2" var sinkCon = Connect(sinkName) ClearText() DisplayGraphics() Print("Copy floppy to coffee") Print("=====================") Sleep(1) if HasFloppy() string floppyName = Input("Floppy name: ") Print("") Print("Data on floppy:") Print("") sinkCon.appendStuff("Floppy: " + floppyName) sinkCon.appendStuff("----------------------------------") sinkCon.appendStuff(" ") var allData = LoadData() loop data in allData Print(data) sinkCon.appendStuff(data) Sleep(0.1) end Print("--------------") Print("Copy completed") sinkCon.appendStuff("----------------------------------") else Print("Please insert floppy...") end end

The data is also output to you current computer so you can see some sort of progress. I've greatly reduced the sleep time, as there's no need to read the text. (You can of course take Sleep() out altogether)

If you'd like to run code on your drinks container, you'll need the floppy data to be commented out. Change
sinkCon.appendStuff(data)
to
sinkCon.appendStuff("# " + data)

Best not to refill the container anywhere - that usually overwrites its contents (though the sink connection does remain).

Oh, and don't forget to change the sink name to that of your preferred sink :)
Last edited by Saldek; Sep 28, 2015 @ 7:18am
Radik Sep 28, 2015 @ 10:45pm 
Is there a way to make a "portable computer/laptop" that can be stored in inventory?
9214 Sep 28, 2015 @ 11:07pm 
I think you can pick up a radio and change its APIs with screwdriver.
< >
Showing 1-15 of 22 comments
Per page: 15 30 50

Date Posted: Sep 26, 2015 @ 12:59pm
Posts: 22