Guif0DA's Forum Posts

  • > there functions (network_players,etc)teclared in the tutorials they exist or is just a random name for them?

    > where I can find all the functions and their definitions??

    >

    First, thanks for trying out the Tut. It would probably help to post this in the Online tutorial thread since it would be easy for me to overlook it otherwise.

    Anyways..the naming of the functions is covered in the tutorial but basically... In podsixnet all user written functions in the client need to start with "Network_" then I added the "players" part to make the function Network_players. This function is right in the .cap file for the client.

    def Network_players(self, data):
          playertext = ("*** players: " + ", ".join([p for p in data['players']]))
          statusBox.AppendText(playertext + "\n")[/code:28kftdwz]
    
    The above function is in the client code that YOU write.  Then in the server you call the code by performing a "player" action like below:
    [code:28kftdwz]   def SendPlayers(self):
          self.SendToAll({"action": "players", "players": [p.nickname for p in self.players]})[/code:28kftdwz]
    
    You also write the above function.  
    
    So the client waits for a network packet with an action of "players" from the server.  When that happens then the function Network_players is called and the data from the server is handled by the client.
    
    Hope this makes sense.
    

    I think I understood

    sry for my bad english first of all.. and thanks one more time for the help

    you first get the ''function' like network that exist in the podsixnet then add a random name and in the server file must be smething declared with that random name to work..that's it?

    makes sense then

  • You could use global variables

  • Please, no one??

    I'll try to explain in a better way..

    there functions (network_players,etc)teclared in the tutorials they exist or is just a random name for them?

    where I can find all the functions and their definitions??

  • in the death menu you could use a global variable or internal variable to set to 1 only when u die and the dialog ''death'' box would only be used after variable was 1..

    like if you die->death variable=1

    and if you retry in the deathmenu->death variable=0

  • Are global variables broken in python? They work for me. The crash related to text global variables was fixed a few builds ago. I made a typo with the syntax of accessing global variables in my other post. I forgot the "System.".

    System.globalvar('ip')[/code:1g5s642u]
    The name of the variable is case sensitive.  Is the name "ip" or "IP" in your cap?
    Also globalvar doesn't show in the right bar, it's just not listed.
    

    it was 'IP' and it worked now! thanks alot

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • family.count is bugged and isn't going to get fixed for 1.0 because the fix for it breaks construct in a much more significant way (tho I can't recall how).

    To get the same result, you can use: for each object, add 1 to a variable.

    thanks for the information

    hope it get fixed soon

  • dude something wrong with your construct...

    i made some testgames to see how much the PC can handle, memory, pc usage, etc...

    3000 objects(sprites) in the visible screen with 50+fps

    640x480 window..

    quad core, 4gb

  • try make it global.

    properties-common->global

  • You can't access global variable strings through Python without a crash...at least the last time I used Construct that was the case.

    My guess is that "ip" is a string... I see what you were probably getting at since you could use events as a workaround to still set a Python variable.

    Hope this helps!

    so variables it gives crash, ya.. and from what i can see, even the function 'globalvar' doesn't exist in the right table after I write 'System' and a dot...

    global numbers work at least?

    ya IP was a string like '127.0.0.1'

    the solution I found is in the first layout make a edit box with the ip, press enter and it saves in globalvar 'IP' the editbox.text

    next layout there are a invisible text object that at the beginning of the frame it sets his text to global 'IP' and during the python script the host gets the text from the invisible text object..

    there is a simple way??

  • Containers isn't the solution, the family would be the solution is in theory the same as the qualities of MMF, create a group of many objects to use at events, like destroy all of'em.. change location of all objects, make all of them enemies, etc..

    but from what i tested family isn't exacly working, i made a text obj and set text to get number objects of family 'x' and it's not counting all of them.

  • While I can't be sure of exactly what you're needing, I'm thinking that you might want to read up on containers. It seems like they could be of use to you.

    ill take a look, thanks.

    also, not about this topic but do u know if construct can create icons for the applications? if so, where?

  • Hello

    Im having some trouble trying to group some objects..

    in MMF I can agroup them with qualifiers but in Construct the qualifier is the families right?

    the problem is that it can only have same objects types in a family...

    I was trying to group some text objects, gradient objects and box object in one family so after awhile I could delete all from this family...

  • > already got the online tutorial and none of them have inside script something like get global value, all of them uses the normal events to do that.

    >

    You would think I would know since I wrote the tut...

    Here are a couple of examples from the tut that get a global variable value:

    connection.Send({'action': 'winner', 'player': System.globalvar('myNum')})[/code:2b1isbqs]
    
    [code:2b1isbqs]connection.Send({'action': 'gotkey', 'player': System.globalvar('myNum'), 'keyuid': System.globalvar('myuid')})[/code:2b1isbqs]
    
    This accesses the global variables:  myNum and myuid.
    
    Edit:  Is "host" in your example a Python variable?  If it is not, that example will not work.
    

    here is teh script, would it work?

    Start Layout

    host = System.globalvar('ip')
    port = 1203
    myclient = Client(host, port)[/code:2b1isbqs]
    
    also thanks for replies
  • Look at the Online Networking Tutorial with Python on the forums..... it has lots of examples of using Python with Global and Private variables. It should help you with your syntax problems.

    Just make sure you are using the latest version of Construct. Even the version used for the original tut has some major Python bugs.

    already got the online tutorial and none of them have inside script something like get global value, all of them uses the normal events to do that.

  • Nevermind, fixed it!

    need to activate 3d mode in layer options!