Ok I am a going to ask

  • I have a plugin that i put up on my server that has a UI. I have several friends that that have this game but they play other game mostly their play on it is so sporadic that I can not have many testing session with multiple people on my server. The other day someone visited and I asked them to test the UI. It appears to work but they said it suddenly opened again and I am not sure if it was me opening it or what. They left before I could evaluate and test again.


    So my question is on Plugins, UIs and command lines. Does opening a UI with a command line keep the event open while the UI is up and mixes up the event player pointer. I thought each client ran the plugins on their own and two players would not interfere. Maybe someone could point me to a decent enough explanation post or some other feedback Thanks

    Edited once, last by angriff: spelling for clarification ().

  • i create a new uielement for each player then set it as an attribute. you if share the same uielement between all players when one opens/closes it it does it for all players. when you create a NEW uielement and set it as an attribute....


    Java
    //add new element to player
    player.setAttribute("panel", panel);
    player.addUIElement(panel);
    //get uielement
    UIElement panel = (UIElement)player.getAttribute("panel");
    //set the element visable
    player.setvisable(true);
  • Das ist Natürlich schwer ohne deinen Code dir genauere Hilfe zu geben.
    Aber Allgemein, musst du für jeden Spieler sein eigenes UIElement erstellen, haben mehrere Speiler das selbe UIElement oder ist dieses Statisch kommt es zu dem Efeckt das der erste es für alle Schließt oder "Geister" eingaben kommen

  • Thank you Gentlemen. One questions is this a UI specific issue or is because it is invoked by a command line then closed by a click on the UI to set visible (false). Based on the very well written comments above I assume it does not matter how any UI is loaded they all interact if they are not assigned to the each player. If you branch using UI buttons to other UIs, I guess you have to invoke these with the same player level protection.


    ;( This appears to be a very serious rewrite to get each panel loaded and updated into a individual player linked UI.


    Well I tried a shortcut so I hope it works. UI still comes up but worried about interactions with it. We will see. Thanks again guys the reason I always loved this community. So much help. I would have never in a million years figured this out alone.


    I was having to update the UI plugin anyway to add some more data to be displayed.

  • Ok so I fixed the several database read issues to dynamically update the panel and they are working fine small syntax errors. If I put in the Code as you outlayed the above it locks up the game. So I moved it up the the on spawn area where I was building and attaching the panel to the player. Down in the /load command area it works if I re-invoke the add panel command. If I only get the attribute it no longer locks up the game but only puts the new information in the top left corner with no panel. This ghosting issue is not as easily licked as I thought. The panel if someone else invokes does not lock up the mouse like if you are the player to do it but you get a view of it that goes away when the other player closes his.


    So my question is it a mistake to build the panel and attach it during the on spawn event or must I build it or rebuild it and update it in every single event method where it can be utilized? I am getting panel is null errors if I try to update it outside of the /load command event.

  • Well I do not know if it is the best form but I had to put the build completely in /load command event because otherwise I got a Null error when I went to update it as attribute.


    Any comments are welcome.

  • probably trying to write to the uielement before its an attribute witch is giving the null errors. i find it best to create uielements onplayerconnect then display them on on the playerspawn event

    Still getting ghosting ... but it is working alot better because started to lock things up when invoked. So I may fix it later. But I have to update the information on it when players act in other plugins. what the best way to do that? It was causing the null issues when it was updating. The information from the element would show up on the top left of the screen as if typed there. The panel would not show up and started to lock up out of the blue.




    PS installed you really nice looking mail plugin so people can give me feedback on my server .. thanks for all your help.

  • if you want to share your code with me i could take a look. just alot of things it could be.

    I would be too embarrassed to do that. I will fight away, thanks of your really good help and pointers.


    I will look at the suggestion you have pointed too and try to adjust it. I tend to helter skelter attack and move or duplicate the lines instead of proper access modifiers and the like. As such there are allot of commented out lines that are their examples of other plugins where I got similar methods that worked in other packages I got to work for switching on and off or examples to help clear problems. I think it is the updating the data part that got me in trouble as I replaced the three live data labels on the panel when the command was invoked. But I had a serious issue in updating my database for new and existing players that I fixed last night mostly. It worked fine when there was only one player (me) Then it kept sending new people to 0.0.0 bottom of the ocean where they promptly drowned. Ooops 8|. I do have that fixed at least now and some people came on and informed me ghosting was still present. However, the movement routine that accessed the several databases and displayed information are working fine now so some progress. :/. This is something that is really simple likely for you but to find a out of place bracket or extra parenthesis could take me hours to correct. I think an AI program could write this is a few milliseconds but where is the puzzle fun in that?

  • I would be too embarrassed to do that. I will fight away, thanks of your really good help and pointers.


    I will look at the suggestion you have pointed too and try to adjust it. I tend to helter skelter attack and move or duplicate the lines instead of proper access modifiers and the like. As such there are allot of commented out lines that are their examples of other plugins where I got similar methods that worked in other packages I got to work for switching on and off or examples to help clear problems. I think it is the updating the data part that got me in trouble as I replaced the three live data labels on the panel when the command was invoked. But I had a serious issue in updating my database for new and existing players that I fixed last night mostly. It worked fine when there was only one player (me) Then it kept sending new people to 0.0.0 bottom of the ocean where they promptly drowned. Ooops 8|. I do have that fixed at least now and some people came on and informed me ghosting was still present. However, the movement routine that accessed the several databases and displayed information are working fine now so some progress. :/. This is something that is really simple likely for you but to find a out of place bracket or extra parenthesis could take me hours to correct. I think an AI program could write this is a few milliseconds but where is the puzzle fun in that?

    everyone makes mistakes, there is no harm in posting your code or parts of the code for users to understand what you are doing, this can be a huge help in helping you, but from what ive read it seems you may not be loading all your ui elements in onPlayerConnect load everything in there and add only the parent to the player, for ones you want showing you need to have the parent element set to setVisible(true); any data for those elements should already be loaded other ui elements should be set setVisible(false); also you only need to add the parent elements to the player all the child elements will automatically be attached to the player, when you want to view an element with all its lables etc you can use the PlayerUIElementClickEvent then set the setVisible(true); like this




    This above code is at its simplest, you may not want to only open UIElements under the PlayerUIElementClickEvent you may want to do it when say a player right clicks a NPC if that NPC == Dummy

    then you just use MarketUI.setVisible(true); as long as you have also included UIElement MarketUI = (UIElement) player.getAttribute("MarketUI"); in your event the UIElement will open

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • Little bit of a different scenario as I do not have anything open to create a on click event. This is opening on a oncommandevent. It seems to be working with Jame1bow's example possibly only a short ghost window with the limited testing I can do.


    Thanks all.

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!