Vlek/elseheartbreak

Unlock() function messages

Closed this issue · 1 comments

First off all, I just have to say I really like your StringSlice() and GetPosition() functions. I don't understand how they work, but they're really cool. I think they can probably be used with a teleporter to transport things with, thus eliminating the need to first teleport a computer (and rendering that computer invisible and unusable) before being able to transport things. Anyways, for the Unlock() function in Util.sprak, you can make the door itself say a message since doors have the Say() function built-in.

P.S. How did you figure out what parameters are accepted by the SetNumericData() function found in Heart?

Vlek commented

Hello! Thank you for the compliments.

GetPosition uses some really wonky string manipulation, i.e. StringSlice, in order to pull out the valid bits of information into usable parts. StringSlice is looping through a string variable, and it's checking for a specific character to stop at. If it hasn't found that character, then it updates its current value to the previous characters plus the current one that it is looking at.

So a string like "Hello world", if I wanted just the "Hello" bit, then I would use:
StringSlice("Hello world", 0, " ")
This would cause it to start at the zeroeth index of the string, and keep adding bits until it hits a space character and return what it found, which would be "Hello".

Honestly, I have no idea why the builtin doesn't give back a list like mine does. It might've been an oversight in thinking of how people would want to use it in combination with other things. They probably thought that their userbase would probably try to output the location and then manually use that information elsewhere. In that case, a string would be perfectly fine. It would have been a good teaching moment if one of the computers had used an array version of the function to create a formatted string however.

Unfortunately, for teleporters, they only have two teleporting functions: SetWorldPosition and Teleport. Neither of them allow anything other than Sebastian to be teleported. I would have much preferred to just use the teleporter's functions, but I believe that might have been another oversight of the dev.

You were right about doors having Say, and I have updated my Util.sprak. Thank you!

The parameters are visible if you type the name of the function and an opening paren, so something like SetNumericData( and then look at the bottom of the code panel where the list of functions are usually present.