|
 |
|
|
|
|
|
GTA Modification Forums
[BETA] GTAIV .Net ScriptHook V1.6.1.1 Released 1.0.6.0 / EFLC Support
 |
|
 |
| |
daimyo21  |
Posted: Thursday, Feb 23 2012, 07:20
|
Player Hater

Group: Members
Joined: Jun 16, 2011

|
So I just made my first script through a tutorial, I have looked at other peoples script to understand C# more yet I been having a universal problem. I have the 0.4.0 Developer SDK and am thinking that this is the problem. puts a red line under base even though I have included the scripthookdotnet in the references... everytime I use base.Blah.Blah.Blah it says unidentified error: 'base' is not a keyword when I type using GTA. (it brings up all the options and base is @base, which doesnt work). Any thoughts? Is there a later developer kit? Much help would be greatly appreciated. EDIT: Just referenced the latest one (not 0.4.0) The one from this thread in "For Developers" folder and GTA.base is still showing up as error This post has been edited by daimyo21 on Thursday, Feb 23 2012, 08:05
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
motorsport71  |
|
newbie modder

Group: Members
Joined: Oct 20, 2009

|
Hey all, i have questions about "gta.nonexistingobjectexception: Invalid call to an object that doesn't exist anymore", specifically during during "gta.ped.get.position". My mods run most frequently either or Now i've discovered that if you try to used them in conjunction throughout a same script it will flag the error, generally quickly, so it's best to stay with just one or the other. Then it can last a long while. Now for the question... So for the Mod i have out right now it is set to run on a 225 ms interval. I always use to try to stop any errors, but they still creep up. Technically on each interval isn't SHDN looking for a pedestrian that it seen last interval? So if the pedestrian was a mission ped, the tick happened, that ped was deleted within the script, and the next tick it looks for them again, does / can that cause the error? If the game "skipped", or a background operation such as an antivirus update kicks on, can that cause it? Can SHDN be getting "Clogged up", or too much information causing it to get "Bottlenecked"? Since my mod is "world.getpeds()" so frequently, is there a way to "ignore" the error, write past past it, so that the error doesn't pop up and the entire mod doesn't stop because it looses track of maybe one wayward pedestrian off in the distance for one tick?
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Prof_Farnsworth  |
|
Ambient Modder

Group: Members
Joined: Feb 25, 2011

|
| QUOTE (motorsport71 @ Sunday, Apr 1 2012, 06:07) | Hey all, i have questions about "gta.nonexistingobjectexception: Invalid call to an object that doesn't exist anymore", specifically during during "gta.ped.get.position".
My mods run most frequently either or Now i've discovered that if you try to used them in conjunction throughout a same script it will flag the error, generally quickly, so it's best to stay with just one or the other. Then it can last a long while.
Now for the question...
So for the Mod i have out right now it is set to run on a 225 ms interval. I always use to try to stop any errors, but they still creep up.
Technically on each interval isn't SHDN looking for a pedestrian that it seen last interval? So if the pedestrian was a mission ped, the tick happened, that ped was deleted within the script, and the next tick it looks for them again, does / can that cause the error?
If the game "skipped", or a background operation such as an antivirus update kicks on, can that cause it?
Can SHDN be getting "Clogged up", or too much information causing it to get "Bottlenecked"?
Since my mod is "world.getpeds()" so frequently, is there a way to "ignore" the error, write past past it, so that the error doesn't pop up and the entire mod doesn't stop because it looses track of maybe one wayward pedestrian off in the distance for one tick? |
Best thing I can recommend is to make sure you have "Exists" checks on everything you are using. Even if you use "And" or "Or" in your statements, have a check in each of the conditions. Also, when done with a ped or vehicle, I recommend using "ped/vehicle.NoLongerNeeded();" so the game does not keep track of it longer than it needs to, and can erase it if need be. In my Fire Dept. mod, that error was the bane of my existence due to the randomness of exploding vehicles, traffic, etc. I literally have checks everywhere to make sure something exists.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
AngryAmoeba  |
|
Symbiont

Group: Members
Joined: Jan 12, 2009


|
This is bad practice, but here's what I do to ignore the NonExistingObjectException errors from GetPeds(). I usually use C#, so forgive me if this VB.NET code isn't quite right... | CODE | ' Declare pedArray as an empty array, in case GetPeds() fails. Dim pedArray() = New Ped() { }
' Use a try-catch to handle the exception without crashing. Try pedArray = GTA.World.GetPeds(centerPosition, range) Catch ex As NonExistingObjectException Dim errorMsg As String = ex.Message ' You can do something with this error message, like print it to the console ' or write it to a file. For public releases, I just leave it like this, so ' that it's ignored. End Try
' If GetPeds() failed, then pedArray remains empty and this loop will do nothing. For Each p As Ped In pedArray If Not Exists(p) Continue ' Do stuff for each ped Next |
Note: This technique works in C#, but VB might crash at the for-each loop when pedArray is empty. If so, just declare pedArray with "Dim pedArray() As Ped" instead, and then after the try-catch, make sure pedArray "Is Not Nothing". @Prof_Farnsworth In my mods, I make sure peds/vehicles exist just once per function. I don't think the game actually continues to do stuff while your script is executing, because if you do a long, intensive calculation, the game "freezes" each time your script executes, causing stuttering/lag. To me, this indicates that the game can't continue to process other stuff until your script is done — then game stuff executes, then your script executes again, then game stuff executes again, etc. etc. If I'm wrong, someone please tell me! P.S. The above is assuming you haven't used Wait(). If your script waits, then a ped might not exist anymore after it's done waiting. This post has been edited by AngryAmoeba on Tuesday, Apr 3 2012, 02:11
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Prof_Farnsworth  |
|
Ambient Modder

Group: Members
Joined: Feb 25, 2011

|
| QUOTE (AngryAmoeba @ Tuesday, Apr 3 2012, 01:27) | This is bad practice, but here's what I do to ignore the NonExistingObjectException errors from GetPeds(). I usually use C#, so forgive me if this VB.NET code isn't quite right...
| CODE | ' Declare pedArray as an empty array, in case GetPeds() fails. Dim pedArray() = New Ped() { }
' Use a try-catch to handle the exception without crashing. Try pedArray = GTA.World.GetPeds(centerPosition, range) Catch ex As NonExistingObjectException Dim errorMsg As String = ex.Message ' You can do something with this error message, like print it to the console ' or write it to a file. For public releases, I just leave it like this, so ' that it's ignored. End Try
' If GetPeds() failed, then pedArray remains empty and this loop will do nothing. For Each p As Ped In pedArray If Not Exists(p) Continue ' Do stuff for each ped Next |
Note: This technique works in C#, but VB might crash at the for-each loop when pedArray is empty. If so, just declare pedArray with "Dim pedArray() As Ped" instead, and then after the try-catch, make sure pedArray "Is Not Nothing".
@Prof_Farnsworth In my mods, I make sure peds/vehicles exist just once per function. I don't think the game actually continues to do stuff while your script is executing, because if you do a long, intensive calculation, the game "freezes" each time your script executes, causing stuttering/lag. To me, this indicates that the game can't continue to process other stuff until your script is done — then game stuff executes, then your script executes again, then game stuff executes again, etc. etc. If I'm wrong, someone please tell me!
P.S. The above is assuming you haven't used Wait(). If your script waits, then a ped might not exist anymore after it's done waiting. | @Angry - I was getting errors inside "if" statements that already checked if the ped existed, then used them. However, I also use a fair amount of "Wait's" in my code.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
motorsport71  |
|
newbie modder

Group: Members
Joined: Oct 20, 2009

|
@AngryAmoeba I appreciate that. I recently found and example that is using "Is Not Nothing" during each call in the pedarray() so now it's looking a lot like this: | CODE | Dim peds as ped() = world.getpeds(player.character.position, 100.0) for each ped as ped in peds if exists(ped) andalso ped Is Not Nothing then **ped assignments / values end if next |
I would just previously use "If exists(ped)", but adding the "Is Not Nothing" seems to have made it much more stable as suggested so you are definately correct there. Very stable. I will also keep the write around technique in mind if i cannot get the secondary part of my script, the more resource intensive one, to remain stable. Thanks again. @Prof_Farnsworth I also went through the entire script and added the checks as you suggested, but i used the above mentioned "Is Not Nothing" in vehiclearray() as well. As you suggested, it helps a ton. Thanks Guys!
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
TechnoKuchen  |
|
Player Hater

Group: Members
Joined: Oct 9, 2011


|
omg Please Help me ScriptHookDoTnet.asi NEVER Works -.- The game just doesn't turns on , nothing shows up Game nevers starts Win 7 /game Patch 7 tryed several Scripthook.dll's Never works And if i remove the ScripthookdotNET.asi, the game works fine Someone has a idea why ? This post has been edited by TechnoKuchen on Wednesday, Apr 4 2012, 09:28
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
AngryAmoeba  |
Posted: Wednesday, Apr 4 2012, 00:39
|
Symbiont

Group: Members
Joined: Jan 12, 2009


|
| QUOTE (motorsport71 @ Tuesday, Apr 3 2012, 08:01) | @AngryAmoeba I appreciate that. I recently found and example that is using "Is Not Nothing" during each call in the pedarray() so now it's looking a lot like this:
| CODE | Dim peds as ped() = world.getpeds(player.character.position, 100.0) for each ped as ped in peds if exists(ped) andalso ped Is Not Nothing then **ped assignments / values end if next |
I would just previously use "If exists(ped)", but adding the "Is Not Nothing" seems to have made it much more stable as suggested so you are definately correct there. Very stable. |
Actually, Exists() already includes the "Is Not Nothing" check, so you don't need to do it again after using Exists(). Edit: Exists() is equivalent to "object IsNot null AndAlso object.Exists()". I just did some reading on VB.NET, and it turns out 'null' is not the same as 'Nothing', so what I said might be wrong. I guess my best advice, really, is just to use C# instead. It's less confusing!  For me, the NonExistingObjectException is not a problem in the for-each loop, but in the "pedArray = World.GetPeds(center, range)" statement. That's why I recommended putting it inside a try-catch. This post has been edited by AngryAmoeba on Wednesday, Apr 4 2012, 01:12
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
motorsport71  |
Posted: Tuesday, Apr 10 2012, 04:56
|
newbie modder

Group: Members
Joined: Oct 20, 2009

|
When using and using | CODE | | Ped.BecomeMissionCharacter() | to keep up a large group of mission peds, say approximately 35, and I have the script constantly replace "dead" or "nolongerneeded" peds: Why is it that after around 100+ mission peds have been replaced they begin to spawn like a "statue" or "solid", with no brain and completely invulnerable? Also, what can be done to prevent that? I need the pedestrian to remain a mission character to get the tasks and actions necessary, so if i nolonger want to use a ped is it better to at the desired distance "delete" the ped or go with "nolongerneeded" if it's a mission ped? Does one over the other leave a "memory leak" i believe it may be referred to? @AngryAmoeba I've been running the "if exists(x) andalso x isnot nothing" and though it looks confusing as you mentioned, it works quite well  I know it would be smart of me to look into c#, but i'm not a coder and v.b. "looked" easier to understand as i looked over the two when i decided to try to code my first .net script.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Pages:
(146) « First ... 140 141 [142] 143 144 ... Last »
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|