Ident as Net-Variable

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
steeffeen
Translator
Translator
Posts: 2463
Joined: 14 Oct 2012, 16:22
Location: Germany

Ident as Net-Variable

Post by steeffeen »

Hey there,

I'm wondering why Idents can't be declared as net-variable since quite some time, is there a major problem which would prevent this or may it be possible in the future?
Because it would help a lot if it would be possible to pass Idents to clients :)

example:

Code: Select all

declare netwrite Ident Net_ImportantPlayerId for UI;
Regards,
Steff
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    User avatar
    TGYoshi
    Posts: 795
    Joined: 15 Mar 2011, 16:59

    Re: Ident as Net-Variable

    Post by TGYoshi »

    Idents are instance references and thus can not be serialized properly. It's probably the reason why not and it's quite logical.
    =3
    User avatar
    steeffeen
    Translator
    Translator
    Posts: 2463
    Joined: 14 Oct 2012, 16:22
    Location: Germany

    Re: Ident as Net-Variable

    Post by steeffeen »

    hm, i don't really get the "Instance references" thing, isn't Ident a simple type used as key in many array? if it's a reference, how do i get the according instance from the Ident then?

    thanks for the response anyways :)
      Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

      ManiaControl, FancyManiaLinks
      User avatar
      TGYoshi
      Posts: 795
      Joined: 15 Mar 2011, 16:59

      Re: Ident as Net-Variable

      Post by TGYoshi »

      Idents seem to be some internal dirty thing.
      Idents are, however, dynamic on their own, which could also be the reason why it's not transferable.
      =3
      User avatar
      steeffeen
      Translator
      Translator
      Posts: 2463
      Joined: 14 Oct 2012, 16:22
      Location: Germany

      Re: Ident as Net-Variable

      Post by steeffeen »

      TGYoshi wrote:Idents seem to be some internal dirty thing.
      i will probably go with that :lol:
        Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

        ManiaControl, FancyManiaLinks
        Kaphene
        Posts: 37
        Joined: 02 Apr 2013, 21:38

        Re: Ident as Net-Variable

        Post by Kaphene »

        is there not a way to convert an Ident to a text or string type variable and then pass that to net?

        like

        declare Text[] PlayersIdents;
        foreach(Player in Players)
        {
        PlayersIdents.add(Player.Id);
        }

        and then do whatever you want with PlayersIdents?


        I know it's not that simple exactly, but isn't there some way to convert?
        User avatar
        steeffeen
        Translator
        Translator
        Posts: 2463
        Joined: 14 Oct 2012, 16:22
        Location: Germany

        Re: Ident as Net-Variable

        Post by steeffeen »

        Kaphene wrote:is there not a way to convert an Ident to a text or string type variable and then pass that to net?
        well, yes

        it would rather be like:

        Code: Select all

        declare Text[] PlayersIdents;
        foreach(Player in Players)
        {
          PlayersIdents.add(""^Player.Id);
        }
        
        but you can't use the string as key for the arrays, you would have to compare (IdentString == ""^Object.Id) all the time, i know that there are some work-arounds but using the Idents directly would be a lot easier
          Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

          ManiaControl, FancyManiaLinks
          User avatar
          TGYoshi
          Posts: 795
          Joined: 15 Mar 2011, 16:59

          Re: Ident as Net-Variable

          Post by TGYoshi »

          Well Idents ARE insanely dirty.
          For example take the BlockScriptId in an EditorPlugin. It's an integer. However, it refers to the Ident of a block when a maptype is ran so you have to convert the Ident of a block when the game runs to an integer (first to a string, then strip the # using TextLib) to compare it...
          =3
          Post Reply

          Return to “ManiaScript”

          Who is online

          Users browsing this forum: No registered users and 1 guest