EmptyEpsilon icon indicating copy to clipboard operation
EmptyEpsilon copied to clipboard

Script reference ambiguity

Open Xansta opened this issue 3 years ago • 5 comments
trafficstars

There are several examples of this kind of ambiguity, but I'll just cite this one. For determining if shields are active, the current script reference looks like this:
Screen Shot 2022-03-22 at 9 27 19 AM
It's a little ambiguous whether or not this is a stand alone function or one that is attached to something else. Admittedly, it kind of appears like it's attached to ShipTemplateBasedObject, but it's hard to tell when you look at the adjacent entries:
Screen Shot 2022-03-22 at 9 30 34 AM Also, it's hard to establish the relationship to ShipTemplateBasedObject just based on the formatting alone.

In the previous script reference, it was clear that the function should be part of a ship template based object:
Screen Shot 2022-03-22 at 9 32 31 AM

It's good to know that the function returns a boolean, but it would also be good to know that the function should be attached to a ship template based object. Could we have it look more like this: boolean ShipTemplateBasedObject getShieldsActive()

Xansta avatar Mar 22 '22 14:03 Xansta

Could we have it look more like this: boolean ShipTemplateBasedObject getShieldsActive()

That wouldn't make much sense IMO, you would need the : as seperator, otherwise the relationships of the types boolean and ShipTemplateBasedObject won't be clear.

btw. It is still clear that getShieldsActive() is member of ShipTemplateBasedObject, as it's in the ShipTemplateBasedObject category, but I agree that it was more obvious in the older version.

aBlueShadow avatar Mar 22 '22 22:03 aBlueShadow

I am also not sure what you mean by "when you look at the adjacent entries". The class is determined by the category (in this case ShipTemplateBasedObject), not by adjacent entries.

Are you referring to "ShipTemplateBasedObject setImpulseSoundFile"? That has nothing to do with the category, ShipTemplateBasedObject is just the type of the return value (like boolean in the other example). As the description says "Returns the object it was called on.", so that's why the return value is incidentally the same data type as the class of the function

aBlueShadow avatar Mar 22 '22 23:03 aBlueShadow

I didn't notice that this was changed. But, I like the object object:setImpulseSoundFile(string) form the best, so the old method with return data info added to it.

daid avatar Mar 23 '22 07:03 daid

Adjacent meaning the entry right before it and the entry right after it. The one before relates to the impulse sound and the one after relates to the shares energy with docked. Yes, the colon makes much more sense to be included as well. I didn't see any colons on any of the new stuff, so I was not sure if there was a reason for its omission.

I think I mentioned it in another context, but the all mono-spaced font all the time motif is a little harder to read in conjunction with the minimal indention. However, that's formatting, and not germane to this particular issue.

Xansta avatar Mar 23 '22 20:03 Xansta

The reason I removed the class name in every method was so because it made return values look strange, especially if it's repeated

ShipTemplateBasedObject ShipTemplateBasedObject:setShieldsActive(boolean active)

The compromise was that I pinned the class header, so it always says where you are at the top of the page.

Also, global functions are not mixed in with the methods, they are all at the very top of the document

edave64 avatar Mar 24 '22 13:03 edave64

@Xansta Doesn‘t the merged change fix this? Or can this be closed?

edave64 avatar Oct 22 '22 15:10 edave64