Else Heart.Break()

Else Heart.Break()

View Stats:
Greyshe_wolf Mar 7, 2016 @ 11:18am
Spoilers - I've written my own program but have some questions.
First off I am having so much fun self-teaching myself how to write a program and experimenting I've only just realised I haven't eaten anything all day, oops!

I've created a portable program that I keep on a floppy so I can boot it anywhere (I'll paste the code in at the end) but I'm a little stuck. When I list all the rooms it gets cut off so I can't read all of them. How can I get the array to print out fully so I can read it? I know from using count that there's 274 rooms.

Also I've been using the GetItemsInRoom function in order to find an object, get it's position and then teleport to it but some rooms don't seem to have anything in them so I can't teleport to them that way. Can anyone give me a nudge in the right direction?

There's a floppy disk in the Police Exterior area which is on a computer that I can't select to pick up or read, I originally started writing this program to try and get it but haven't managed it yet. I think I'll take a screenshot and upload it to show people.

Also what are APIs and what would I get from messing with them with the screwdrivers?

Can I teleport to people's inventories or am I just best using SetPosition to steal what I want? (Svante is so getting his taser nicked, I'm never quick enough to zap him before he gets me. Still need to write the Move Item function. I have the feeling this is gonna be a monstrous program)

Here's my code:
var MF = Connect("MainFrame")
MainMenu()
void MainMenu()
ClearText()
Print("Main Menu")
Print("")
Print("1. Sell Some Soda")
Print("2. Search a Room")
Print("3. Find an object")
Print("4. Find a Person")
Print("5. Query Object Type")
Print("6. Check Function")
Print("7. Unlock a Door")
Print("")
Print("Please Make a Selection:")
var mc = Input("")
if(mc == "1")
SellSoda()
else if(mc == "2")
SearchRoom()
else if(mc == "3")
FindObject()
else if(mc == "4")
FindPerson()
else if(mc == "5")
QueryType()
else if(mc == "6")
CheckFunction()
else if(mc == "7")
UnlockDoor()
else
Print("I'm sorry but I didn't understand " +mc+ ". Please Make Another Selection")
Input("Press any key to go back. ")
MainMenu()
end
end
void SellSoda()
ClearText()
Print("Sell Sodas")
Print("")
Print("How much money has been made?")
number Money = Input("")
string name = GetUser()
var wellspring = Connect("Wellspringer")
wellspring.RegisterSeller(name, Money)

Print("")
Print("The amount of " +Money+ " has been registered")
Input("Please press a key")
MainMenu()
end

void SearchRoom()
ClearText()
Print("Search Room")
Print("")
Print("Which Room Would You Like to Search?")
var Room = Input("")
Print(MF.GetThingsInRoom(Room))
Print("")
Print("Do you wish to search another room?")
var cont = Input("")
if(cont == "y")
SearchRoom()
else
MainMenu()
end
end

void FindObject()
ClearText()
Print("Find an Object")
Print("")
Print("Enter Object Name")
var on = Input("")
Print(MF.GetPosition(on))
Print("")
Print("Would you like to search for another object?")
var conto = Input("")
if(conto == "y")
FindObject()
else
MainMenu()
end
end

void FindPerson()
ClearText()
Print("Find a Person")
Print("")
Print("Enter Person's Name")
var pn = Input("")
Print(MF.GetPosition(pn))
Print("")
Print("Would you like to search another name?")
var contn = Input("")
if(contn == "y")
FindPerson()
else
MainMenu()
end
end

void QueryType()
ClearText()
Print("Query Type of Object")
Print("")
Print("Enter Name of Object")
var qo = Input("")
Print(MF.GetTypeOfThing(qo))
Print("")
Print("Would you like to search another object?")
var cqo = Input("")
if(cqo == "y")
QueryType()
else
MainMenu()
end
end

void CheckFunction()
ClearText()
Print("Check Function")
Print("")
Print("Enter Name of Object")
var cho = Input("")
Print("")
Print("Enter Function to Search for")
var chf = Input("")
var choc = Connect(cho)
if(choc.HasFunction(chf))
Print("The object has the function " + chf)
else
Print("The object doesn't have a function called " + chf)
end
Print("")
Print("Would you like to check another function?")
var ccf = Input("")
if(ccf == "y")
CheckFunction()
else
MainMenu()
end
end

void UnlockDoor()
ClearText()
Print("Unlock a Door")
Print("")
Print("Enter Name of Door")
var ud = Input("")
var uc = Connect("Computer1")
uc.Unlock(ud)
Print("")
Print(ud+ " is now unlocked")
Print("")
Print("Would you like to unlock another door?")
var cud = Input("")
if(cud == "y")
UnlockDoor()
else
MainMenu()
end
end
< >
Showing 1-8 of 8 comments
Bidubida Mar 7, 2016 @ 4:50pm 
When I list all the rooms it gets cut off so I can't read all of them. How can I get the array to print out fully so I can read it? I know from using count that there's 274 rooms.
When does the code get cut off ?
It would have been great to paste the buggy code.

It sounds like an array access error.
If you loop i from 0 to Count(rooms), with an access to rooms[i] it will stop at the 274th occurence because index 274 does not exists (indexes will start from 0 and end at 273). You'll have to loop from i 0 to (Count(rooms) - 1)

I also know that screwdriver can modify limited execution time of computer but I never tried this function as a never encountered a program who stopped without having an error.

And for apis I've still not enought knowledge for this right now, sorry :)

Hoping this could help you !
Last edited by Bidubida; Mar 8, 2016 @ 1:41pm
Greyshe_wolf Mar 8, 2016 @ 12:15am 
Very much so! The code I was running for the rooms wasn't a loop, it was simply Print(GetAllRooms()) and it usually cut off with a ... after one of the Hotel rooms was listed. My handy little program is now running loops to search for rooms and things with parameters so now I should be able to add this new function without much difficulty. Will run this and see what I get, thanks again!
obskyr Mar 8, 2016 @ 12:32am 
Some background on this: The pretty-printing algorithm Erik wrote for lines cuts off arrays if they're too long with a "..." after, I'd assume in order not to print absurd amounts of text for large arrays. As you might've found out by now, the best way to print a list of things is to loop over the items in it and print them individually.

And is this an instance of actually learning programming through Else Heart.Break()? That's really cool!
Last edited by obskyr; Mar 8, 2016 @ 12:32am
Greyshe_wolf Mar 8, 2016 @ 12:55am 
Heh, it is! I have never taken any sort of programming course. Though I did have to create a custom function in Excel after I maxed out the number of arguements in a nested if statement trying to calculate income tax according to the different tax rates. I also have played a programming puzzle game called Tis-100 which uses a language called Assembly. I've played Uplink and Hacknet to which are less programming more hacking but I think the experience helps.

I'm learning so much and really curious what sort of things I could use my new found knowledge in RL. Maybe I should dust off Excel and go wild. Must remember that Slurp isn't a real thing (shame). I am so chuffed that I figured out how to get my extractor to copy the name of whatever I've targeted so I don't have to keep writing the names down. So handy!

Oh and I got the disk I wanted that I mentioned before, I wrote a code to search for floppys with Police in the name then moved it to Sebastian and Viola! Well worth it too as it had a Slurp position I'd not been to. Currently driving myself crazy trying to get to the house on stilts over the tracks in Harbor North near the fancy houses. Tried searching for the radio I can see and the door but nada!

If I can get the rooms sorted then I'll find out whether it's a real place or not, I'll kick myself if I've been trying to get to a phantom place.
Last edited by Greyshe_wolf; Mar 8, 2016 @ 12:59am
Greyshe_wolf Mar 8, 2016 @ 3:28am 
So I've written this little program to list the rooms and save the data to a floppy disk. Thank you for the help, sometimes you just need a nudge in the right direction. Still not sure how to teleport to a room if it has no items in it but I may figure it out yet.

I've had to change the array brackets "[" and "]" to { and } otherwise it turns my text italic.

var MF = Connect("MainFrame") ListRooms() void ListRooms() ClearText() Print("List Rooms") Print("") Print("Choose Starting Number: ") var stn = Input("") Print("") Print("Choose Ending Number: ") var enn = Input("") Print("") array a = MF.GetAllRooms() loop i from stn to enn Print(a{i}) SaveData(a{i}) end Print("Finished Search") Print("") Input("Press any key to return: ") ListRooms() end
Last edited by Greyshe_wolf; Mar 8, 2016 @ 3:30am
obskyr Mar 8, 2016 @ 7:28am 
Originally posted by Greyshe_wolf:
Still not sure how to teleport to a room if it has no items in it but I may figure it out yet.

Very very few rooms contain no objects - even the forest dream scene contains "Point" objects. The few rooms without objects, however, can be teleported to, though not through slurping or a computer (technically everything in EHB is a computer, but you know what I mean). Hope you find it!

There may also be another way to get to places you can see but not go to, perhaps... Perhaps...

Oh, and if you want to get into real-world programming, I'd recommend going for a proper programming language! It's not as hard as it sounds. Technically I suppose Excel formulas are a "proper programming language", but... once again, you know what I mean. :happyelf:
Greyshe_wolf Mar 8, 2016 @ 9:06am 
Heh, you shoulda seen when I first started playing TIS-100, I'd look at the aim of the puzzle and be like "You want me to do what now??". But it's just a case of learning the commands, what they can be used for and what commands can be used together to achieve the desired aim.

A disk in Ratvader's place says there is a disk with all the locations (and I'm hoping co-ordinates). I've dubbed this disk the Holy Grail and plan to write a program to try and find it some how. You are right about there being very few rooms without even points (Foley crashed my game, my compiler got stuck), there's three I can think of off the top of my head.

If the Holy Grail doesn't have co-ordinates then I've got no idea how to visit the last few places I've not been to. May need to give my brain a break.

Btw has anyone else discovered slurping to "HelloWorld" takes you to NickeRoom? I translated the morse code on a digital trash disk and tried connecting to the answer and voila!
Bidubida Mar 8, 2016 @ 1:53pm 
Originally posted by Greyshe_wolf:
I've had to change the array brackets "[" and "]" to { and } otherwise it turns my text italic.
Actually we can use [noparse][/noparse] tag to avoid this problem (I edited my preceding post acording to this).

Originally posted by Greyshe_wolf:
var stn = Input("") var enn = Input("") loop i from stn to enn # do something end

Takes care with user inputs, stn and enn could be outside of the bonds of your array ! You should check validity of theese before process to loop.


Originally posted by obskyr:
Oh, and if you want to get into real-world programming, I'd recommend going for a proper programming language! It's not as hard as it sounds. Technically I suppose Excel formulas are a "proper programming language", but... once again, you know what I mean. :happyelf:
Yeah sure, programming with computer oriented platform (does this mean something ?), allow you to manipulate more things than in-game arcades or tabulated data ^^



Originally posted by Greyshe_wolf:
If the Holy Grail doesn't have co-ordinates then I've got no idea how to visit the last few places I've not been to. May need to give my brain a break.
Better read the comments :p
Originally posted by obskyr:
There may also be another way to get to places you can see but not go to, perhaps... Perhaps...

Originally posted by Greyshe_wolf:
Btw has anyone else discovered slurping to "HelloWorld" takes you to NickeRoom? I translated the morse code on a digital trash disk and tried connecting to the answer and voila!
Ahhh no I didn't tried. I saw somes morse data floppy, but I put them down immediately, I hate translating things from morse in games ^^ (If somebody made the program to read it give it to me :D)
Last edited by Bidubida; Mar 8, 2016 @ 1:54pm
< >
Showing 1-8 of 8 comments
Per page: 15 30 50