• Content Count

  • Joined

  • Last visited

Posts posted by Hugos

  1. 9 hours ago, Overkillz said:
    local yourtick = getTickCount()
    local alpha = 0
    function yourFunctionRendering()
    	local progresstick = getTickCount() - yourtick
    	local progress = progresstick/500
    	if progress >= 1 then progress = 1 end
    	alpha = interpolateBetween(0,0,0,1,0,0,progress,"Linear")
    	guiSetAlpha ( yourWindow, alpha )

    Something like this. Remember that eachtime you need to update the animation you have to restart 'yourtick'

    And deal with the condition to fadeout. I've just give you an example of fadein without the condition.



  2. 3 hours ago, MrTasty said:

    Most animations are driven by an easing function - the simplest of which is Linear, but you could write your own easing equation - for example, y = x+math.sin(6.29x) if you want to, but most likely you won't need it. If you want something to appear smoothinly, use the return of an easing function as the alpha parameter; if you want it to slide onto the screen, use it for x or y position.

    Oh, right! Thanks))
    And how I didn 't think of it.

  3. Tell me, are there options for animations such as smooth appearance or fading? (These are Animations that are NOT driven by type "Linear," InQuad, "etc.)?


  4. I had a problem. When I click on "body" I have a missing "go." What to do? Help.

    addEvent("PlayerJoined", true)
    function PlayerJoined()
        setCursorPosition(x/2, y/2)
        body = guiCeateStaticImage(x/2-(y/(1080/280)/2), y/2+y/8.5, y/(1080/280), y/(1080/50), "gfx/go!.png", false)
        go = guiCreateStaticImage(x/2-(y/(1080/400)/2), y/2-(y/(1080/530)/2), y/(1080/400), y/(1080/530), "gfx/body.png", false)
    addEventHandler("PlayerJoined", localPlayer, PlayerJoined)


  5. Just now, WorthlessCynomys said:

    If you set relative to true, then you have to provide values from 0.0 to 1.0 (think of them as percentages 0-100 of the parent element). So the first element you draw is relative to the parent which is the screen, so the first element is relative to the screen. The second element as the child (part) of the first is relative to the first one. That's all. That applies to all CEGUI elements, including staticImage.


  6. Just now, WorthlessCynomys said:

    guiCreateStaticImage makes a CEGUI element.

    dxDrawImage draws an image with the lifetime of a frame. You have to call dx functions on every frame.

    Well. Can you tell me more about how to make the dimensions of the picture "guiCreateStaticImage" relative?

    I have an image with dimensions 400x530, I set "width" - y/2.7, how do I do to have "height" exhibited automatically?
    P.S: x, y = guiGetScreenSize()

  7. What is the difference between "guiCreateStaticImage" and "dxDrawImage." For example, I draw panel and buttons using images. What 's best to use?

  8. Hello to everyone. I want to make sure that the player 's name is displayed above his head, but I don 't know how to do it correctly. Found the function "dxDrawTextOnElement" - I can 't understand how to apply it correctly?

    P.S: Also I want to add a team with which players can choose whether they will see the names of other players or not. Is it possible to implement this?

  9. Just now, IIYAMA said:

    Triggers can't be deleted, only prevented by not trigger them.

    If it is not possible to delete, then such a question:
    I have "guiCreateStaticImage," and I use "onClientGUIClick" for the image.
    What function do I need to add them to avoid using a trigger?

  10. Just now, Overkillz said:

    Could you just tell me why not ?

    I have never used this, but you can try.

    triggerEvent("trig", resourceRoot)
    addEvent("trig", true)
    function trig()
    	removeEventHandler("trig", resourceRoot, trig)
    addEventHandler("trig", resourceRoot, trig)


    Triggers are not deleted like this.

  11. Just now, Overkillz said:

    Just use a boolean to check if is running or not.

    triggerEvent("trig", resourceRoot)
    local isRunning = false
    addEvent("trig", true)
    function trig()
    	if not isRunning then
    		isRunning = true
    addEventHandler("trig", resourceRoot, trig)

    Such an option is not suitable.

  12. Just now, Overkillz said:

    Could you be more specified ?

    If you want to remove an event to prevent his execution, just, don't execute it.


    I need to delete it after running)

  13. Would you please tell me how to remove the trigger?

    For example:

    triggerEvent("trig", resourceRoot)
    addEvent("trig", true)
    function trig()
    addEventHandler("trig", resourceRoot, trig) to remove it?

  14. 21 hours ago, IIYAMA said:

    The player list is dynamic. The location of the players in the table is changing when players are leaving.


    Player list (table)

    local players = getElementsByType("player")


    New players are added on the back of the table.

    players = {
     [1] = player1, [2] = player2, [3] = player3 
    players[4] = player4
    players = {
     [1] = player1, [2] = player2, [3] = player3, [4] = player4



    Leaving players are collapsing the list.

    players = {
     [1] = player1, [2] = player2, [3] = player3, [4] = player4
    table.remove(players, 1) -- player1 is leaving
    players = {
     [1] = player2, [2] = player3, [3] = player4



    If you want to generate IDs, you have to make sure they are always unique.

    do -- < Closed environment for the variable: id. Nothing can edit it, except for the newId function.
    	local id = 0
    	function newId()
    		id = id + 1
    		return id
    local playerIDs = {}
    function getIDFromPlayer(player)
    	local id = playerIDs[player]
    	if not id then
    		id = newId()
    		playerIDs[player] = id
    	return id

    Note, this table doesn't clean it self, yet.


    I didn 't get it a little bit. Then how should the function fully look?

  15. I have such a system for oral ID to the player:

    		function getIDFromPlayer(player)
    			if player then
    				local theid
    				players = getElementsByType("player")
    				for id,p in ipairs(players) do
    					if player == p then
    						theid = i
    			return theid
    		else return false end

    Please help. I need to make sure that every player is assigned an ID at spawn. But I now work a little off-line (when the player comes out with id 1, the player with id 2, assigned id 1, but I need this player to have id 2 left, and the one who comes in - established id 1-n  (is not busy) ).

  16. Tell me please if it is possible to make a function that opens an adress URL in your browser?
    P.S.: I mean open a browser not in the game (not createBrowser), but in a regular browser (out of the game).