Help[FSOD] Need help with code...

Posts 16–17 of 17 · Page 2 of 2
Quote Originally Posted by LordChronos View Post
@Demon dude I'm stupid... I din't really test your code back then and now I have an error : (Attachment not verified) The problem is " 'i' does not exist in the current context.

Now if I try to fix it my way, the previous problem arises.
What should I do?

OOC, I sent you a friend request
Don't upload your images in an MPGH format upload it in like an igmur link but...

it says that because I gave you a part of the code, you have to combine it with your existing code.

Code:
for (var i = 0; i < Inventory.Length; i++)
            {
               if (Inventory[i].ObjectId == "Dragon Pearl")
               {
                   Inventory[i] = Manager.GameData.Items[0x108e];
                   Player.SendInfo("Quest Complete");
                   UpdateCount++;
                   SaveToCharacter();
                   for (var e = 0; e<= Inventory.Length; e++)
                    {
                        if (Inventory[e] == "Task Tablet 1")
                            {
                                Inventory[e] = Manager.GameData.Items[...];
                                return true;
                            }
                    }
               }              
            }
if tasktablet one is consumed try something like this...

Code:
for (var i = 0; i <= Inventory.Length; i++)
            {
                bool questcomplete = false;
                if (Inventory[i].ObjectId == "Dragon Pearl")
                {
                    Inventory[i] = Manager.GameData.Items[...];
                    Update++;
                    SaveToCharacter();
                    SendInfo("Quest Complete");
                    questcomplete = true;
                }
                if (Inventory[i] == null && questcomplete == true)
                {
                    Inventory[i] = Manager.GameDate.Items[...];
                    return;
                }
            }
Quote Originally Posted by Demon View Post
Don't upload your images in an MPGH format upload it in like an igmur link but...

it says that because I gave you a part of the code, you have to combine it with your existing code.

Code:
for (var i = 0; i < Inventory.Length; i++)
            {
               if (Inventory[i].ObjectId == "Dragon Pearl")
               {
                   Inventory[i] = Manager.GameData.Items[0x108e];
                   Player.SendInfo("Quest Complete");
                   UpdateCount++;
                   SaveToCharacter();
                   for (var e = 0; e<= Inventory.Length; e++)
                    {
                        if (Inventory[e] == "Task Tablet 1")
                            {
                                Inventory[e] = Manager.GameData.Items[...];
                                return true;
                            }
                    }
               }              
            }
if tasktablet one is consumed try something like this...

Code:
for (var i = 0; i <= Inventory.Length; i++)
            {
                bool questcomplete = false;
                if (Inventory[i].ObjectId == "Dragon Pearl")
                {
                    Inventory[i] = Manager.GameData.Items[...];
                    Update++;
                    SaveToCharacter();
                    SendInfo("Quest Complete");
                    questcomplete = true;
                }
                if (Inventory[i] == null && questcomplete == true)
                {
                    Inventory[i] = Manager.GameDate.Items[...];
                    return;
                }
            }
That explains it, when there are 2 'for i' statements I got the variable already defined error, so long ago I put f in place of the second i.
But for some reason it replaced all my items with the next task tablet :P
I'll try this out later, thanks again!
Posts 16–17 of 17 · Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us