Home Tech Support
Welcome to the new Diaspora forums, please let us know if you see anything broken! Notice: Some users may need to reupload their avatars due to an issue during forum setup!

E2 bugs: E:getShield()

XellXell Registered Posts: 11
edited July 2013 in Tech Support #1
Hi, how to report bugs? here? :D
If so there is report:

@inputs A:entity
B = A:getHull()
gives Error:
sv: Expression 2 (generic): entities/gmod_wire_expression2/core/custom/ShipCore.lua:8: Tried to use a NULL ent
i know where is problem, but its annoying when i have to check the target every time...

btw: Same with: getHullPercent() getHullMax() shield,armor

Comments

  • LtBrandonLtBrandon Registered, Administrator Posts: 507
    Xell wrote:
    Hi, how to report bugs? here? :D
    If so there is report:

    @inputs A:entity
    B = A:getHull()
    
    gives Error:
    sv: Expression 2 (generic): entities/gmod_wire_expression2/core/custom/ShipCore.lua:8: Tried to use a NULL ent
    i know where is problem, but its annoying when i have to check the target every time...

    btw: Same with: getHullPercent() getHullMax() shield,armor
    Which server is this on? If its on server 2 please try it on server 1 and report back.
    This is a block of text that can be added to posts you make. There is a 255 character limit.

    Lλmbdλ: donations for coding the space future of diaspora :>

    Get your extra long EVE trial here!
  • XellXell Registered Posts: 11
    Server 1 :P

    EDIT: Just tried on server 2 and it doesnt work too!
  • LtBrandonLtBrandon Registered, Administrator Posts: 507
    Xell wrote:
    Server 1 :P

    EDIT: Just tried on server 2 and it doesnt work too!
    Were you using the function on a core entity?
    This is a block of text that can be added to posts you make. There is a 255 character limit.

    Lλmbdλ: donations for coding the space future of diaspora :>

    Get your extra long EVE trial here!
  • XellXell Registered Posts: 11
    The entity is NULL but the proble is: when you want to check shield/armor/hull of your enemy and the ship is just destroyed it kill the E2
    Edit:
    entity():getShield()
    
    (like when you target the E2 chip) works well (returns "0")
  • SteeveeoSteeveeo Registered, Administrator Posts: 849
    This is where you need something that we in the programming world call a "Sanity Check".

    A lot of things will crash an E2, but most of those are trying to do things to NULL values. What you wanna do here is check if A is not null before doing your check:
    if(A != noentity())
    {
    <do stuff with A>
    }
    

    That's not a bug, that's just programming. ;)
  • XellXell Registered Posts: 11
    Thats bug of your lua according to me.
    I know about
    if(A != noentity())
    
    and i found a solution almost instantly
    if(A:isValid())
    
    but by "while(perf()) test" with valid entity and second timer i got 15,000(the code below) tries per second from 45,000(the code without "if(C!=noentity())")
    while(perf())
    {
        B++
        if(C!=noentity())   
        { 
             C:getShield()
        }
    }
    
    And finally its hard to find line with "scrip error" in long code..

    Edit: i got 17 000 tries per scond with
    if(C:isValid())
    
    :P
    and each other programming language would scream at you: "ERROR AT LINE 500 YOU DUMBASS YOU CANNOT DIVIDE STRING BY VECTOR"
  • KanzukeKanzuke Registered, Moderator Posts: 181
    @input A:entity
    
    if(A:type():sub(1,9) == "ship_core") {
             B = A:getHull()
    }
    
    

    Command doesn't much like being given an input that isn't a ship core, I expect it hates NULL entities

    Lambda217: oh oh i am kanzuke and i love my little pony and now i'll make all the brandonphysics myself cause i know fuckin everything because now i'll make a big pony fighter drone squad and a big fuckin portal ship and i am a fuckin idiot

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file