Silv3rPRO / proshine

A free, open-source and advanced bot for Pokémon Revolution Online.
https://proshine-bot.com/
MIT License
52 stars 69 forks source link

Object reference not set to an instance of an object. #17

Closed 423956 closed 8 years ago

423956 commented 8 years ago

Receiving the error " Object reference not set to an instance of an object." when the trainer encounters a Pokemon. is effecting 100% of all my scripts that involve attacking that previously worked.

Scripts that catch pokemon and run away from the rest are uneffected.

g0ldPRO commented 8 years ago

To get help with scripting, post on the help section of the forum.
The tickets are strictly use to report bugs that come from the bot and can be explicitly reproduced.

423956 commented 8 years ago

Have tryed editing scripts multiple times, using scripts other people say work, etc.

Tryed reinstalling proshine/netframework/rebooting pc Tryed using a outdated version of PROshine nothing is fixing it

423956 commented 8 years ago

This is not due to scripting.

g0ldPRO commented 8 years ago

Unless you know exactly what function of the API is returning a nil reference when it should not, this does not concern the bot.

423956 commented 8 years ago

The thing is it's almost impossible for anyone to recreate other then me and the other users who suffer from this bug, as scripts that work PERFECTLY for everyone else, do not work for us.

E.g

name = "Mt Silver 1F"
author = "X0r9"
description = "Train and farm money at Mt Silver 1F"

function onPathAction()
    if isPokemonUsable(1) then
        if getMapName() == "Mt. Silver Pokecenter" then
            moveToMap("Mt. Silver Exterior")
        elseif getMapName() == "Mt. Silver Exterior" then
            moveToMap("Mt. Silver 1F")
        elseif getMapName() == "Mt. Silver 1F" then
            moveToRectangle(46, 55, 53, 55)
        end
    else
        if getMapName() == "Mt. Silver 1F" then
            moveToMap("Mt. Silver Exterior")
        elseif getMapName() == "Mt. Silver Exterior" then
            moveToMap("Mt. Silver Pokecenter")
        elseif getMapName() == "Mt. Silver Pokecenter" then
            usePokecenter()
        end
    end
end

function onBattleAction()
    if isWildBattle() and isOpponentShiny() then
        if useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") then
            return
        end
    end
    if getActivePokemonNumber() == 1 then
        return attack() or sendUsablePokemon() or run()
    else
        return run() or attack() or sendUsablePokemon()
    end
end

This script was working fine for me 3 days ago, and now i cannot run it.

g0ldPRO commented 8 years ago

Reading the related post on the forum. This would be a bug with isOpponentEffortValue().

I need to know what pokemon you were fighting when it happened and where it happened.

423956 commented 8 years ago

I was in azaleia forest and it happend on 100% of pokemon.

Also, It is not the ev that does it.

The script i posted above does not request evs, it is a simple leveling script and when i run it i get this.

http://i.imgur.com/TghfYtD.png

It walks fine to the location, the second it is in battle same error.

Any script that i have that involves attack()

423956 commented 8 years ago

or sendUsablePokemon() will not work.

g0ldPRO commented 8 years ago

There is no bug from the API that cannot be reproduced. If something works for everyone but you, that means you did something different. Maybe your team is different, maybe something else, that's what we should determine.
Unless you used a different version of the bot 3 days ago, the bug already was there when you used the script before, maybe something was different with your character then, something that is related to this bug, once again, that's what I need to know to fix the bug, if there is one.

g0ldPRO commented 8 years ago

What version of PROShine are you using?

423956 commented 8 years ago

I believe i have worked out what is causing this, allow me two minutes for further testing.

423956 commented 8 years ago

I have worked out the issue, earlier i said machamp i meant slowbro, the slowbro i recently taught scald. When a pokemon has scald it will give this error.

423956 commented 8 years ago

After removing scald from slowbro it now runs smoothly. thanks for your time!

g0ldPRO commented 8 years ago

There is a misunderstanding there. When opening an issue you engage yourself in the resolution of a software bug.
If the bug is still there it needs to be identified and fix.

You may have find a workaround but the bug still exists and I have no idea why scald could create this kind of bug.

g0ldPRO commented 8 years ago

Your error is:

Object reference not set to an instance of an object.

Right?

Could you please replace the onBattleAction by this and paste me the 20 last lines before it returns the previous message:

https://gist.github.com/g0ldPRO/09180f03701211ea9a7a35bf96e2df50

423956 commented 8 years ago

Alright, should i get scald tm and teach slowbro it again before doing this?

g0ldPRO commented 8 years ago

If it's necessary to reproduce the bug, then yes.

423956 commented 8 years ago

Okay one moment mate.

423956 commented 8 years ago

Now does not even leave the poke center.

[1:13:49 a.m.] Connecting to the server... [1:13:50 a.m.] Connected, authenticating... [1:13:53 a.m.] Authenticated successfully! [1:13:53 a.m.] System: Welcome to Pokemon Revolution Online. (Blue Server) [1:14:00 a.m.] Script "Mt Silver 1F" by "X0r9" successfully loaded [1:14:00 a.m.] Train and farm money at Mt Silver 1F [1:14:02 a.m.] Bot started [1:14:02 a.m.] Error during the script execution: Object reference not set to an instance of an object. [1:14:02 a.m.] Bot stopped

g0ldPRO commented 8 years ago

That cannot be related to the late change, since the onBattleAction() has not been executed. Can you past me the entire script you ran? (preferably using https://git.github.com )

423956 commented 8 years ago

https://gist.github.com/423956/fe39fdfa83ccb26793747a9c78eb630b

g0ldPRO commented 8 years ago

What about the output of this one? https://gist.github.com/g0ldPRO/2a133ecb904affaf2557046f1439fb44

423956 commented 8 years ago

That returns the following;

1:23:43 a.m.] Connecting to the server... [1:23:44 a.m.] Connected, authenticating... [1:23:45 a.m.] Authenticated successfully! [1:23:45 a.m.] System: Welcome to Pokemon Revolution Online. (Blue Server) [1:23:49 a.m.] Script "Mt Silver 1F" by "X0r9" successfully loaded [1:23:49 a.m.] Train and farm money at Mt Silver 1F [1:23:50 a.m.] Bot started [1:23:50 a.m.] isPokemonUsable(1) [1:23:50 a.m.] Error during the script execution: Object reference not set to an instance of an object. [1:23:50 a.m.] Bot stopped

g0ldPRO commented 8 years ago

Can you try learning another attack instead of scald?

Alternatively, or if it does not work can you paste all the attacks of the first pokemon? Slowbro right?

g0ldPRO commented 8 years ago

I won't be there for one hour of so, I'll have a look at that issue later in the day.

423956 commented 8 years ago

Yeah i'll be on for 5 or 6 more hours or so. I'm happy to help in anyway i can, just let me know if you need me. Let me change scald and show you logs.

423956 commented 8 years ago

[1:29:38 a.m.] Bot started [1:29:38 a.m.] isPokemonUsable(1) [1:29:38 a.m.] true [1:29:45 a.m.] isPokemonUsable(1) [1:29:45 a.m.] true [1:29:55 a.m.] isPokemonUsable(1) [1:29:55 a.m.] true [1:29:59 a.m.] isPokemonUsable(1) [1:29:59 a.m.] true [1:30:01 a.m.] isPokemonUsable(1) [1:30:01 a.m.] true [1:30:01 a.m.] A Wild Quagsire Attacks! [1:30:07 a.m.] onBattleAction() [1:30:07 a.m.] isWildBattle() [1:30:07 a.m.] true [1:30:07 a.m.] isOpponentShiny() [1:30:07 a.m.] getActivePokemonNumber() [1:30:07 a.m.] 1 [1:30:07 a.m.] attack() [1:30:07 a.m.] true [1:30:07 a.m.] Slowbro Attacks Quagsire with Surf. [1:30:07 a.m.] Quagsire Attacks Slowbro with Earthquake. [1:30:07 a.m.] Slowbro restored HP using Leftovers! [1:30:11 a.m.] onBattleAction() [1:30:11 a.m.] isWildBattle() [1:30:11 a.m.] true [1:30:11 a.m.] isOpponentShiny() [1:30:11 a.m.] getActivePokemonNumber() [1:30:11 a.m.] 1 [1:30:11 a.m.] attack() [1:30:11 a.m.] true [1:30:13 a.m.] Slowbro Attacks Quagsire with Surf. [1:30:13 a.m.] Slowbro restored HP using Leftovers! [1:30:13 a.m.] Quagsire has fainted! [1:30:13 a.m.] Slowbro gained 39636 Exp. [1:30:13 a.m.] You found 418 Pokedollar(s). [1:30:13 a.m.] You have won the battle. [1:30:14 a.m.] isPokemonUsable(1) [1:30:14 a.m.] true [1:30:15 a.m.] isPokemonUsable(1) [1:30:15 a.m.] true [1:30:16 a.m.] isPokemonUsable(1) [1:30:16 a.m.] true [1:30:17 a.m.] isPokemonUsable(1) [1:30:17 a.m.] true [1:30:17 a.m.] isPokemonUsable(1) [1:30:17 a.m.] true [1:30:19 a.m.] isPokemonUsable(1) [1:30:19 a.m.] true [1:30:20 a.m.] isPokemonUsable(1) [1:30:20 a.m.] true [1:30:21 a.m.] A Wild Golbat Attacks! [1:30:27 a.m.] onBattleAction() [1:30:27 a.m.] isWildBattle() [1:30:27 a.m.] true [1:30:27 a.m.] isOpponentShiny() [1:30:27 a.m.] getActivePokemonNumber() [1:30:27 a.m.] 1 [1:30:27 a.m.] attack() [1:30:27 a.m.] true [1:30:28 a.m.] Golbat Attacks Slowbro with Venoshock. [1:30:28 a.m.] Slowbro Attacks Golbat with Psychic. [1:30:28 a.m.] It's Super Effective! [1:30:28 a.m.] Slowbro restored HP using Leftovers! [1:30:28 a.m.] Golbat has fainted! [1:30:28 a.m.] Slowbro gained 43194 Exp. [1:30:28 a.m.] Slowbro has grown to level 59. [1:30:28 a.m.] You found 252 Pokedollar(s).

g0ldPRO commented 8 years ago

scald move is missing from PROProtocol/moveManager.cs.
I guess it was added more recently and the array was not updated then.

ghost commented 8 years ago

@g0ldPRO Yes, you are right, I have added the move in #19 in order to prevent this issue to repeat again. I haven't tested it yet.

@423956 Let me know if it works.

423956 commented 8 years ago

Yes it is working fine now! Thanks guys

Silv3rPRO commented 8 years ago

Seems to be fixed by #19, thanks!