[Ohrrpgce] Zone references

Ralph Versteegen teeemcee at gmail.com
Wed Apr 20 21:34:16 PDT 2022


I think I'll go ahead and add the "get zone" command since I don't see much
reason not to, and we can rename it or add special syntax to call it later.

On Thu, 21 Apr 2022 at 15:12, Ralph Versteegen <teeemcee at gmail.com> wrote:

> I want to make the extra data functions ("get extra", etc) usable on
> zones. It would be possible for them to interpret small positive integers
> as zone IDs. But I'm rather off-put by code like this, where it's
> completely unobvious that it's acting on zones:
>
>   assert(get extra(5, -1) == 2147483647)
>   set extra(5, -2, 32)
>   assert(extra length(5) == 3)
>
> I would prefer self-documenting code. Plus it monopolises small integers
> as zone IDs when they could be any sort of ID or slot (in particular it
> would be nice if heros had extra data too).
>
> Some proposals:
> -Add "zone reference" which returns the zone ID + a large constant to set
> the HandleType. These references don't need to (can't) be deleted. They
> should work with all existing zone commands too
> --Or call it "get zone" instead. Or should we use a different naming
> scheme from existing "get" commands?
> -Add special syntax to HSpeak to translate "zone 5" to "get zone(5)". I
> think this looks nice:
>   set extra(zone 5, -2, 32)
>  However, you need to be able to get a zone from an expression as well as
> an integer constant. So you'd use "get zone(value)" for that.
>  Note that in future when objects are added to HS we need to have a way to
> get objects from IDs, so getzone would return an object rather than a
> handle (there will be a backcompat bit to switch between handles and
> objects), meaning you could write "zone 5.name" which maybe takes a
> little getting used to, and we can add many others like getenemy/"enemy
> 5".  But there shouldn't be a difference in type between "enemy 5" and
> "enemy:plip" so the latter would also change.
> --Or use syntax "zone: 5" instead
> -Just add "zone extra length" and "resize zone extra" commands. I would
> not add any others, so zones would become second-class citizens. We will
> still need "get zone" in future anyway.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20220421/dd51de14/attachment.html>


More information about the Ohrrpgce mailing list