Item Grabber C++ proj Problem menu

User Tag List

Results 1 to 5 of 5
  1. #1
    jmulhern345's Avatar Banned
    Reputation
    93
    Join Date
    Mar 2008
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Item Grabber C++ proj Problem

    case BUYITEM_MENU:
    {
    char BuyItem[100];
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    sprintf(BuyItem, "Enter Item Name [%u]", MORPH_COST/DIVIDER);
    Menu->AddItem(ICON_WHEEL, BuyItem, BUYITEM_FUNCTION, 1);
    Menu->SendTo(Plr);
    }break;

    case BUYITEM_FUNCTION:
    {
    QueryResult *BoughtItem = WorldDatabase.Query("Select `Entry` FROM Tiberium_Items where `Name` = '%s'", Code);

    if(BoughtItem)
    {
    Field *Fields = BoughtItem->Fetch();
    uint32 BoughtItem = Fields[0].GetUInt32();
    Plr->GetItemInterface()->AddItemToFreeSlot(BoughtItem);
    Plr->Gossip_Complete();
    }
    }break;

    ---------------------------------------------------------------------------------------------------------------------------------------

    This is only a tad bit of my script i would rather not post all of it but i am getting this error

    ---------------------------------------------------------------------------------------------------------------------------------------

    1>Compiling...
    1>Warper.cpp
    1>..\src\GossipScripts\Warper.cpp(142) : error C2664: 'ItemInterface::AddItemToFreeSlot' : cannot convert parameter 1 from 'uint32' to 'Item *'
    1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    ---------------------------------------------------------------------------------------------------------------------------------------

    I can't figure it out the function is to type the name of the item into a box and you get the item i got the idea from the aspire stones morpher but i failed like usual.


    Im i'm pretty sure i am posting this in the C++ section if this is in EMu Server guides i apologize LOL

    Item Grabber C++ proj Problem
  2. #2
    Function's Avatar Banned
    Reputation
    5
    Join Date
    May 2008
    Posts
    62
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, from the much I know, Just remember *item would point to the memory of the value of item and item* is the derefrencer which derfrences item

    So if string* item = std::string s1 "Hey foo";

    Then you went something like

    cout << *item; /// It would display the memory value(512 or something more depends on your 32 bit or 64 bit OS) of std::string s1, if you had something more like this cout << item*; it Would display Hey foo; Remember item* and *item are two different things hopefully that may help you but seems you have a type conversion error, as if the pointer doesnt have a value to point to. Just some my info hope i could help!

  3. #3
    jmulhern345's Avatar Banned
    Reputation
    93
    Join Date
    Mar 2008
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    no dice

    Thx for the reply but can you or someone dumb it down so i can understand.

  4. #4
    Le Froid's Avatar Contributor
    Reputation
    172
    Join Date
    Mar 2007
    Posts
    1,327
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at this
    Code:
    uint32 BoughtItem = Fields[0].GetUInt32();
    and see the specific error message
    Code:
    cannot convert parameter 1 from 'uint32' to 'Item *'
    Seems like you assigned BoughtItem wrongly or Item is used in the wrong context or something (I am TERRIBLE at explaining things )
    See if you can fix it

    edit:
    Code:
    Conversion from integral type to pointer type requires reinterpret_cast
    The Item* thing is a pointer while Boughtitem is an integer (
    you have a type conversion error, as if the pointer doesnt have a value to point to. )

    edit2:
    Try re-reading what r00tk3y said, it makes sense after the first few times you read it.
    Last edited by Le Froid; 08-08-2008 at 02:42 AM.

  5. #5
    jmulhern345's Avatar Banned
    Reputation
    93
    Join Date
    Mar 2008
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thx Le Froid!!

Similar Threads

  1. Item Grabber 3.2 - All Arcemu + Mangos
    By miclis in forum WoW EMU Programs
    Replies: 33
    Last Post: 08-03-2010, 06:35 PM
  2. WoW-Database Item Grabber Updated!
    By Heliumz in forum WoW EMU Programs
    Replies: 3
    Last Post: 03-07-2010, 11:33 PM
  3. Problems With ''Adding'' Items
    By sara in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 09-09-2007, 04:23 PM
  4. Some problems with Items...
    By Pimpin_N0ob in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 09-02-2007, 03:07 AM
  5. item problem
    By DJB727 in forum World of Warcraft General
    Replies: 2
    Last Post: 11-25-2006, 02:47 PM
All times are GMT -5. The time now is 05:27 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search