![]() |
Bug: The max loop limit can no longer be avoided serverside with a sleep.
In the past, this code would not have hit the max loop limit because of the sleep.
PHP Code:
Quote:
|
I encountered this problem on Classic too.
|
I've never received a max loop error. Is that anything similar to how php breaks when it takes to long to execute a script? and times out?
or what exactly causes this problem? 1000 loops? |
Quote:
|
Bump, also seems to happen clientside.
|
Is this of the same problem?
I added more for loops because it use to be only this.tempStaff, and 20 strings in the array.. Then the original code only had this one else if for loop checking through the staff. :/ It would then say there was an error in the RC but the level editor still worked.. I didn't really know how to fix the problem but to split the work out into different else ifs... It still doesn't work all that well but does work. Sadly, I think the RC will state a lot of errors, but the people will not know... Is there a way to fix this, or is it the same error as everyone else? I tried to fix it, but I thought the problem was going through all the arrays.. It just says reached a loop limit at 0, 0. Original (20 people / levels) PHP Code:
Code now. PHP Code:
|
Quote:
The rest of the code is also terribly inefficient, can be accomplished by much easier means, and it doesn't really make sense that you're defining this. variables as if they're a temp. variable while using a prefix in the name. Those arrays should be set one time onCreated. |
Oh boy
PHP Code:
e2: but at least if you do it will fail silently! :D |
Quote:
My much easier means that I thought of was doing the .index() but I didn't know how. ^.^; didn't feel like bothering you so I did it with a for loop. Also, they are temp since most of the staff will be deleted after the LAT contest. o.O; I put temp for my own purposes. I believe this was all I had to do. ^.^;; I don't know why I used 'i' twice. Late at night I do stupid things. Added temp. as well, not sure why I left that out either. PHP Code:
I guess my problem was stupidity and drowsiness. -EDIT- However, my friend is trying to create a baddy using a specific algorithm and he is having problems with maxing out the loop only if he doesn't add a sleep .05 in.. I believe he wants something like an onTimeout calling an onTimeout right after the end of checking... Perhaps that is the same problem? I don't know. I doubt he will post on the forums though.. |
Quote:
If you were to remove the first line of player.account in this.tempStaff, it would still work. player.level is an object rather than a string, the correct value to check is 'player.level.name'. It's a bad practise to loop through non-changing arrays and use .size(); for every cycle, as the function will occur every time rather than once, this can generate a lot of overhead with very large arrays. The array size can be defined as a temporary variable beforehand, which can then be used in the loop condition. Quote:
|
Quote:
The second part is only to add +1 to whatever the i is for the level, which I believe I could do with .index() but don't know how... Quote:
Quote:
I shall do that! Quote:
He is not on for me to ask. :[ -Correction- He gave it to me to see, but I don't know if I have the right to expose it. :X So I must ask. |
Quote:
|
Quote:
They just equal the same things in testing, unless I see an error of some kind giving physical evidence why it shouldn't be used I'll probably never fully understand. D: ZeroG's algorithm I'll explain but won't show. It checks every tile within 32x32 of a level spreading out from the NPC. It finds the nearest path to the player, and comes back to it self in the check. After that it moves once... This process repeats over and over and over until it moves towards the player. It uses MANY for loops in the timeout, however, at the end it seems to NOT work if you do not have a sleep(.05); and having that makes it seriously slow... Yet this algorythm works fine on another game that he is making in Simple. He doesn't want me to post it because he doesn't believe anyone else has tried it, nor does he believe anyone can fix it. Is Graal not fast enough to do these type of things? He uses V5 and it slowly comes to him, I use V6 and it seems to do the loop about 3 times before stopping.. if it finds me and I'm close to it then it will move to me once or twice... if I'm about 6 tiles away the finding part of the gets to me and stops... if I'm farther it stops in the same spot too.. If this cannot be helped without images or code than it is fine. |
Quote:
PHP Code:
NPC Code:Object one is 'SomeObject' When the objects are coerced into strings, you get the object names only typically. In this example, it results in two objects appearing to be the same (because their object names are the same) even though we have just proven them to be different. This is something you MUST be aware of when coercing objects into strings in GScript. It doesn't always work how you expect. |
Quote:
Can you do it in layman's terms and possibly actually use levels? Also, why are levels objects and not only strings? I thought levels were only names of a textfiles converted to .nw.. |
Levels are instances of TServerLevel objects.
Level files are parsed/processed and loaded into memory as TServerLevel objects. player.level refers to the TServerLevel object the player is currently in. |
Quote:
Does it make a difference for levels? |
Quote:
|
Quote:
|
Quote:
Quote:
It is like some people saying why not keep some scripts GS1 for some parts if those parts still work and don't necessarily need to be fixed. I think that is a good metaphor? |
Quote:
|
Quote:
Thank you both, much appreciated. |
Quote:
|
All times are GMT +2. The time now is 08:11 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.