Solved World.AirdropAt

Discussion in 'Plugin Development Support' started by salva, Feb 12, 2017.

  1. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    Try to use this code and I get random errors

    Code (Python):
    import clr
    import sys
    clr.AddReferenceByPartialName("Fougerite")
    import Fougerite

    class Advertise:
        def On_PluginInit(self):
            Plugin.CreateTimer("testtimer", 10000).Start()

        def testtimerCallback(self, timer):
            Server.BroadcastFrom("TEST", "RANDOM ERROR???")
            World.AirdropAt(5000, 400, 5000)
            timer.Kill()
            Plugin.CreateTimer("testtimer", 10000).Start()
    And it causes this spam in console

    Imagen 6.jpg

    The error occurs randomly each time the timer is run
    I've tried doing it in C# and so does the same thing.
    Maybe the error is here? - https://github.com/Notulp/Fougerite/blob/master/Fougerite/Fougerite/World.cs#L71-L119
     
    #1
  2. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,444
    Likes Received:
    135
    Code looks fine,
    But you don't need to kill the timer and create it again.
    It will go off every x seconds you pick.
     
    #2
    Last edited: Feb 13, 2017
  3. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    Code (Python):
    import clr
    import sys
    clr.AddReferenceByPartialName("Fougerite")
    import Fougerite

    class Advertise:
        def On_PluginInit(self):
            Plugin.CreateTimer("testtimer", 10000).Start()

        def testtimerCallback(self, timer):
            Server.BroadcastFrom("TEST", "RANDOM ERROR???")
            World.AirdropAt(5000, 400, 5000)
     
    I do not think .... It's still happening.
     
    #3
  4. DreTaX
    Offline

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,838
    Likes Received:
    610
    Not true.

    For some reason the C# timers die after a given time, so it is really recommended to recreate the timer.


    Thanks for the report, I will look into It. btw the original code is okay, be sure to recreate the timer
     
    #4
    • Like Like x 1
  5. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    It would be incredible to repair this error, and thus to be able to play a little more with airdrops xd, if solved let me know, I have plugins waiting for a solution ... thanks
     
    #5
  6. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    I've done it anyway, with different timer methods, in Python and in C # .. and this random error always occurs ...
     
    #6
  7. DreTaX
    Offline

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,838
    Likes Received:
    610
    You could try:

    SupplyDropZone.CallAirDropAt(target);
     
    #7
  8. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    He tried with:

    Code (C#):

    Vector3 pos = new Vector3(5000, 400, -5000);
                SupplyDropZone.CallAirDropAt(pos);
     
    Still giving Random errors

    Client Error Log:

    Exception: Trying to read past the buffer size when calling RPC Method SupplyDropPlane:GetNetworkUpdate - likely caused by mismatching send parameters, different size or order.
    at #=qQB5ODMzkFveAQbdO9M7JO3iQNzSFRwop5_3doWwCK38=.#=qGMP0P8EuYd_X7F9PRWBL5g== (uLink.BitStream #=qCVNyGFe$gydnaZcyMdNONA==, System.Object #=qzSRyfGqly1LHlg30FzDi$Q==, #=qaL2AMBCaBLCj4lGSCwjcBVYUs_5vzeQVgu44HVklVYQ= #=qF0LixpnARxoY9B2O6_AJXQ==) [0x00000] in <filename unknown>:0

    at #=q$NUWz6aT_ypN3cz7K6ce2gVWapiYAlnLPGzKjIUfT2w=.#=qS9ntZNSJqwnPkZv_HZvsug== (uLink.BitStream #=qXGAAwsb5CJJ8S2Ehp7Xk1g==, System.Object #=qUQ_5Y1Yee0zHw5xz3RJs3Q==) [0x00000] in <filename unknown>:0

    at uLink.NetworkView.OnRPC (System.String rpcName, uLink.BitStream stream, uLink.NetworkMessageInfo info) [0x00000] in <filename unknown>:0

    at uLink.NetworkViewBase.#=qpJfiNEhSKsosBj54zW21Bw== (System.String #=q$Jt5MurGgHKDHfFpZi59PA==, uLink.BitStream #=qKVMsbknO$bvRuqZ08STSRA==, uLink.NetworkMessageInfo #=qrmJ6YoTIr0SFnQvRFRz6$w==) [0x00000] in <filename unknown>:0

    at #=qjg$mq9k6hZwR1eaAS3eQ4dux$3oD_j8CRZte$f$nFV0=.#=qlGEZiB55BOeKhe33IbTgs3lVmx7rHXWsIFfTvKtNlrQ= (.#=q__0aJnzE_j5V$E$xqdkd8PUPKgwbochaYTDqzGbXfa0= #=q78dFOyJP5gEJQ7xl3hAFIQ==) [0x00000] in <filename unknown>:0

    at #=qjg$mq9k6hZwR1eaAS3eQ4dux$3oD_j8CRZte$f$nFV0=.#=qIPn628V9gmXGKu9CDwAT4Q== (.#=q__0aJnzE_j5V$E$xqdkd8PUPKgwbochaYTDqzGbXfa0= #=qRwJrOAyIe5SeN4SKl$FtkA==) [0x00000] in <filename unknown>:0

    at #=qZti1eKpmgEiH8RyJbFvrtbtjuOoTgnfxK4EfJn_O0Rw=.#=qbuIDweKOGqCKZ7R1$YWXFvPkygcsdrvEtAZ4Px9OwQQ= (.#=qDyYck6jY0p_qh6doTcsvIbN8t3TKJHLMicx6djrzRdg= #=q5t3WkthVpvyAjzUM2c_1yw==, #=qBQZKBBBvB7$YPJYYJ6uGmZupKsyCo6fust8CQG8ZrYc= #=qguMZxn1$ymoUh2X6TRZqfw==) [0x00000] in <filename unknown>:0

    at #=qZti1eKpmgEiH8RyJbFvrtbtjuOoTgnfxK4EfJn_O0Rw=.#=qBJbY7Rvju_MJxDnWLOQuYufOeJyKrm7ov2fiKefxxhc= () [0x00000] in <filename unknown>:0

    at #=qZti1eKpmgEiH8RyJbFvrtbtjuOoTgnfxK4EfJn_O0Rw=.#=queaDNRLAGdOgw3nB9XdoFA== () [0x00000] in <filename unknown>:0

    at #=qjg$mq9k6hZwR1eaAS3eQ4dux$3oD_j8CRZte$f$nFV0=.#=qqJfJJIU5OocEzCry9eP0ew== () [0x00000] in <filename unknown>:0

    at #=qSBVG6i3HoKQx$z3bwADYIgVX_kCktQP8JwBh1CI$O_8=.#=qK4rBLHQlJi1c$9ISNO6Z6w== () [0x00000] in <filename unknown>:0

    at uLink.InternalHelper.LateUpdate () [0x00000] in <filename unknown>:0

    (Filename: Line: -1)

    Server Error Log:

    Code (Text):
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: viewID
    Can't subscribe uLinkNetworkView "SupplyCrate(Clone)" (ViewID 60291) since there
    already exists one with ViewID 60291 at uLinkNetworkView "C130(Clone)" (ViewID
    60291)
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: viewID
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: viewID
     
    #8
    Last edited: Feb 12, 2017
  9. xandeturf
    Offline

    xandeturf Moderator Moderator

    Joined:
    Nov 4, 2015
    Messages:
    132
    Likes Received:
    9
    Show all your code, there is something wrong with your code because it worked correctly here.
    I put it drop every 10 seconds.
     

    Attached Files:

    #9
  10. DreTaX
    Offline

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,838
    Likes Received:
    610
    I think you are not using the prepatched ulink.dll, but it should work without that.
     
    #10
  11. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    All the python code this definition here http://fougerite.com/threads/world-airdropat.1237/ can you try use this code you self during 5 mins .

    Yes, I am using prepatched ulink.dll
     
    #11
  12. xandeturf
    Offline

    xandeturf Moderator Moderator

    Joined:
    Nov 4, 2015
    Messages:
    132
    Likes Received:
    9
    i not use python. But try this.
    If it does not work remove the ("World.AirdropAt (5000, 400, 5000)") and verify that the timer is working correctly.

    Code (Python):
    import clr
    import sys
    import System
    clr.AddReferenceByPartialName("Fougerite")
    import Fougerite

    class Advertise:
        def On_PluginInit(self):
            Plugin.CreateTimer("TestTimer", 10000).Start()

        def TestTimerCallback(self, ATimedEvent):
            ATimedEvent.Kill()
            Server.BroadcastFrom("TEST", "RANDOM ERROR???")
            World.AirdropAt(5000, 400, 5000)
     
    #12
  13. xandeturf
    Offline

    xandeturf Moderator Moderator

    Joined:
    Nov 4, 2015
    Messages:
    132
    Likes Received:
    9
    @DreTaX I noticed that the Hook OnAirdropCalled does not detect SupplyDrop is there any other way to detect the SupplyDrop? If the answer is not, would it be possible to update?
     
    #13
  14. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    Dude, the timer is not relevant to that error, the problem comes from World.AirdropAt ...

    It is a random error, it does not happen every time the timer runs ....
    When it happens, there is a plane paralyzed in the air and the rest of the planes are still normal ...
     
    #14
  15. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    Are you using the Facepunch.ID reference to do that SupplyDropZone.CallAirDropAt(pos);?

    And what do you try to call an airdrop when an airdrop is already called?, That's scary !!! Xd
     
    #15
  16. xandeturf
    Offline

    xandeturf Moderator Moderator

    Joined:
    Nov 4, 2015
    Messages:
    132
    Likes Received:
    9
    i not use python D: , my test was in C#.
    try World.CallAirDropAt(pos) or World.SupplyDropZone.CallAirDropAt(pos)
    pos Should not it be a Vector3?
     
    #16
  17. DreTaX
    Offline

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,838
    Likes Received:
    610
    SupplyDropZone.CallAirDropAt(target);

    is a native method so its pretty weird. this error has been around for a time, i guess its a rust fuckup.
     
    #17
  18. salva
    Offline

    salva Friendly self-taught developer Administrator

    Joined:
    Jan 31, 2016
    Messages:
    569
    Likes Received:
    82
    recovering this conversation yesterday in Discord with @gintaras ... It occurred to me that maybe it could be that when calling an airdrop inside a timer, maybe ... I should use Loom to keep it in the main thread and BUM !!!! .... no longer gives errors, therefore it is solved ....then ... @DreTaX


    Code (Python):
    import clr
    import sys
    clr.AddReferenceByPartialName("Fougerite")
    import Fougerite

    class AirdropTest:
        def On_PluginInit(self):
            Plugin.CreateTimer("testtimer", 10000).Start()

        def testtimerCallback(self, timer):
            timer.Kill()
            Server.BroadcastFrom("TEST", "RANDOM ERROR???")
            Loom.QueueOnMainThread(lambda:
            World.AirdropAt(5000, 700, -5000)
            )
            Plugin.CreateTimer("testtimer", 10000).Start()
     
    #18
    • Like Like x 1

Share This Page