Results 1 to 8 of 8

Thread: What is wrong... Object reference not set to an instance of an object...

  1. #1
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10

    (Solved) What is wrong... Object reference not set to an instance of an object...

    Ok, I'm seriously stumped and/or too tried.

    The following action seems to work perfectly fine, however it keeps throwing the following error every second when there are 3 or more monsters around me:
    Code:
    7:57 AM : Game:ItemList:FindItemByName - System.NullReferenceException: Object reference not set to an instance of an object.   at (Object )   at ..(String name)
    Thats right... it doesnt say on what line or anything, thats all it says...

    Here is the action. It is an action that disables targeting spells and then uses an aoe rune on the ground, then/and/or sets targeting spell back when less than 3 monsters are around.


    The following is in my setup:
    PHP Code:
    nameRune "great fireball rune" -- Health potion to use
    exoriCount -- Use rune when there are this many monsters
    creaturesToHit 
    = {"Giant Spider""Mutated Bat""Tarantula"} -- List the monsters to use rune on
    pvpServer 
    false -- Bool for server type 


    PHP Code:
    if pvpServer and maround(3unpack(creaturesToHit)) >= exoriCount and paround(7true) == and itemcount(nameRune) > 0 then
    setsettings
    ("Settings\\Targeting\\Monsters\\Giant Spider\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
    setsettings("Settings\\Targeting\\Monsters\\Mutated Bat\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
    setsettings("Settings\\Targeting\\Monsters\\Tarantula\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
    useitemon(nameRuneposxposyposz)

    elseif 
    not pvpServer and maround(3unpack(creaturesToHit)) >= exoriCount and itemcount(nameRune) > 0 then
    setsettings
    ("Settings\\Targeting\\Monsters\\Giant Spider\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
    setsettings("Settings\\Targeting\\Monsters\\Mutated Bat\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
    setsettings("Settings\\Targeting\\Monsters\\Tarantula\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
    useitemon(nameRuneposxposyposz)
    else

    setsettings("Settings\\Targeting\\Monsters\\Giant Spider\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
    setsettings("Settings\\Targeting\\Monsters\\Mutated Bat\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
    setsettings("Settings\\Targeting\\Monsters\\Tarantula\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
    end 
    Last edited by pink_panther; 10-10-2012 at 10:35 PM.

  2. #2
    Normal User
    Join Date
    Jun 2012
    Location
    Sweden
    Posts
    1,671
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    8 Post(s)
    Reputation
    132
    Rep Power
    9
    Do you got GFB in Items.xml? It might be the error.
    "ItemList:FindItemByName"

  3. #3
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    SODER, my man!

    I did think of, and check, that... but it still shoots the rune anyway...

    Furthermore, when I just copy "useitemon(nameRune, posx, posy, posz)" or the setsettings() from "No Action" to "Flame strike" into an action by themselves to isolate the issue, it doesn't throw the error, it just works...

    It's making me a bit insane with its own inconsistencies.

  4. #4
    Normal User
    Join Date
    Jun 2012
    Location
    Sweden
    Posts
    1,671
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    8 Post(s)
    Reputation
    132
    Rep Power
    9
    Try this, removed the else statement after the elseif statement.

    PHP Code:
    if (pvpServerthen
        
    if (maround(3unpack(creaturesToHit)) >= exoriCount) and (paround(7true) == 0) and (itemcount(nameRune) > 0then
            setsettings
    ("Settings\\Targeting\\Monsters\\Giant Spider\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
            
    setsettings("Settings\\Targeting\\Monsters\\Mutated Bat\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
            
    setsettings("Settings\\Targeting\\Monsters\\Tarantula\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
            
    useitemon(nameRuneposxposyposz)
        else
            
    setsettings("Settings\\Targeting\\Monsters\\Giant Spider\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
            
    setsettings("Settings\\Targeting\\Monsters\\Mutated Bat\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
            
    setsettings("Settings\\Targeting\\Monsters\\Tarantula\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
        
    end
    elseif not (pvpServerthen
        
    if (maround(3unpack(creaturesToHit)) >= exoriCount) and (itemcount(nameRune) > 0then
            setsettings
    ("Settings\\Targeting\\Monsters\\Giant Spider\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
            
    setsettings("Settings\\Targeting\\Monsters\\Mutated Bat\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
            
    setsettings("Settings\\Targeting\\Monsters\\Tarantula\\ListSettings\\Setting0\\ListSpell\\Spell0""No Action"
            
    useitemon(nameRuneposxposyposz)
        else
            
    setsettings("Settings\\Targeting\\Monsters\\Giant Spider\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
            
    setsettings("Settings\\Targeting\\Monsters\\Mutated Bat\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
            
    setsettings("Settings\\Targeting\\Monsters\\Tarantula\\ListSettings\\Setting0\\ListSpell\\Spell0""Flame Strike"
        
    end
    end 

  5. #5
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    I have a bool for pvpServer, I get the error when its true or false also.

    I'll give this a try when I get home, if it helps, you'll have some more rep comin' your way.

  6. #6
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Ok i tested it out and it does the same thing..

    However, I created a brand new script with ONLY that action and setup and it doesnt occur. What is wierd is that when the whole script is loaded, it only generates this error when this action is running...

    It really is doing my head in.

  7. #7
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Ok it might have something to do with targeting.... If i run the script, open states and turn off targeting, it still fires runes, but doesnt throw this error.

    Also if I run a script that just changes the spell to flame strike to no action and vise versa, the error doesnt occur. I think its just a bug with the bot...

    EDIT: YAAAAAAAAAAAAAY, I figured it out...

    What is happening is that, because targeting is enabled, and a spell exists, when 3 or more monsters are around me and the spell changes to "No Action", it still tries to cast "No Action" but because the object reference is not set to an instance, it throws the error

    Kind of annoying.. not sure how to "stop" it from occurring, as I definitely want it changing to no action so it doesn't exhaust when using aoe runes.

    I think it was the "FindItemByName" part in the debug that was throwing me off.

    Thanks Soder for the help anyway.
    Last edited by pink_panther; 10-10-2012 at 10:36 PM.

  8. #8
    Normal User
    Join Date
    Nov 2012
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    12
    Rep Power
    5
    LOL! After searching for the soulution for a couple of hours i stumbled across your thread!
    Thanks Pinky!
    "No Action" is tricy sometimes :-D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •