ID:2748779
 
Resolved
When converting a generator() to a string, sometimes the resulting text was wrong.
BYOND Version:514
Operating System:Windows 10 Home 64-bit
Web Browser:Firefox 94.0
Applies to:Dream Daemon
Status: Resolved (514.1572)

This issue has been resolved.
Descriptive Problem Summary:
When you turn a generator object into a string it returns something that, at a first glance, looks like it accurately represents the arguments passed to the generator() proc. That would be pretty handy for stuff like serialization of particle effects. However, at a second glance it is clear that the actual output is very different and it seems like this might not be intentional. If it is intentional I apologize.

EDIT: Seems like at least some of these issues might be applicable only to some generator types.

Numbered Steps to Reproduce Problem:
1.) Create a generator object with some arguments
2.) Turn it into a string and observe the strange output

Code Snippet (if applicable) to Reproduce Problem:
var/x = generator("circle", list(10, 10), 5, NORMAL_RAND)
world.log << "[x]"


Expected Results:
Presumably something like:
generator("circle", list(10, 10), 5, NORMAL_RAND)


Actual Results:
generator(338, GAUSS\_RAND, 0, 5

The arguments are in different order. GAUSS_RAND is not even a macro in DM. There is no closing parenthesis. The vector has been replaced by a 0. The "circle" has been replaced by 338.

Does the problem occur:
Every time? Or how often? Every time
In other games? Yes
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?
N/A

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
In 514.1566 it seems that NORMAL_RAND instead displays as UNIFORM_RAND, other issues remain.

Workarounds:
In case you want to extract information about the generator again track it in a separate list whenever generator() gets called.
Lummox JR resolved issue with message:
When converting a generator() to a string, sometimes the resulting text was wrong.
Note: list(0,10) is not valid in a circle generator, which is part of the issue you saw. The only bugs in play with this example were that NORMAL_RAND was outputting as the old name GAUSS_RAND, and that there was no closing parenthesis.
Unsure if these issues are also fixed reading your last post so I'll also just iterate them here as well to be safe

The generator type also needs to be wrapped in double quotes. Currently it prints it without any quotes.

The RAND argument is meant to come after the A and B arguments, not before

edit: it looks like generators that take lists end up coming through ok, they're just not wrapped in double quotes (e.g. vector, box). Generators that just take single value inputs however, spit out some numbers instead for the generator type (e.g. cube, circle)

haven't tested all of them to be certain, but found it to be an interesting observation
Not important, but this is more like a feature request. The conversion of non-atoms to text is never expected to be a good representation of it, so it not giving a good representation isn't a "bug", it's just a feature you're asking for. If there's a bug here, it's that it doesn't just give "/generator".

For serialization, it doesn't seem like generators can even be saved to savefiles. That seems like a bug to me, as everything else can be saved with at least the built-in serializer.