KyoParadox Posted February 7, 2010 Share Posted February 7, 2010 As the title says, I'm having some difficulties with GetStoreMarkUp/Down. For some reason they always return -1. I tried calling it during dialogue, during the store GUI and right after calling SetStoreMarkUp/Down (which does work). Here's the script, as you can see I'm calling GetStoreMarkUp/Down in several places in case it only works during a certain point. Not that it matters. :(void main() { //Storage_HandleModuleEvents(); event ev = GetCurrentEvent(); int nEventType = GetEventType(ev); switch(nEventType) { case EVENT_TYPE_MODULE_LOAD: { //PrintToLog("STORE_INVESTMENT - STARTED"); break; } case EVENT_TYPE_GUI_OPENED: { int nGUI = GetEventInteger(ev, 0); // ID number of the GUI that was opened if(nGUI == GUI_STORE) { object oStoreX = GetObjectByTag(GetLocalString(GetModule(), "STORE_INVEST_MERCHANT")); int nStoreBuyX = GetStoreMarkDown(oStoreX); int nStoreSellX = GetStoreMarkUp(oStoreX); PrintToLog("STORE_INVESTMENT - Merchant Values (STORE GUI): " + IntToString(nStoreBuyX) + " vs " + IntToString(nStoreSellX)); } break; } case EVENT_TYPE_CREATURE_ENTERS_DIALOGUE: { object oCreature = GetEventCreator(ev); // object oStoreX = GetObjectByTag("store_" + GetTag(oCreature)); object oStoreXOld = GetObjectByTag(GetLocalString(GetModule(), "STORE_INVEST_MERCHANT")); if(IsObjectValid(oStoreX)) { PrintToLog("STORE_INVESTMENT - Merchant Opened: " + GetTag(oStoreX) + ". Last Merchant: " + GetTag(oStoreXOld)); int nStoreBuyX = GetStoreMarkDown(oStoreX); int nStoreSellX = GetStoreMarkUp(oStoreX); PrintToLog("STORE_INVESTMENT - Merchant Values (DIALOGUE): " + IntToString(nStoreBuyX) + " vs " + IntToString(nStoreSellX)); if(oStoreX != oStoreXOld) { SetLocalString(GetModule(), "STORE_INVEST_MERCHANT", GetTag(oStoreX)); SetLocalInt(GetModule(), "STORE_INVEST_BUY_MAX", nStoreBuyX); SetLocalInt(GetModule(), "STORE_INVEST_SELL_MIN", nStoreSellX); SetStoreMarkDown(oStoreX, 100); SetStoreMarkUp(oStoreX, 100); int nStoreBuyX = GetStoreMarkDown(oStoreX); int nStoreSellX = GetStoreMarkUp(oStoreX); PrintToLog("STORE_INVESTMENT - Merchant Values (STATIC): " + IntToString(nStoreBuyX) + " vs " + IntToString(nStoreSellX)); } } break; } case EVENT_TYPE_GAMEMODE_CHANGE: { if (GetEventInteger(ev,0) == GM_EXPLORE && GetEventInteger(ev,1) == GM_GUI) { object oStoreX = GetObjectByTag(GetLocalString(GetModule(), "STORE_INVEST_MERCHANT")); if(IsObjectValid(oStoreX)) { int nStoreBuyX = GetLocalInt(GetModule(), "STORE_INVEST_BUY_MAX"); int nStoreSellX = GetLocalInt(GetModule(), "STORE_INVEST_SELL_MIN"); SetStoreMarkDown(oStoreX, nStoreBuyX); SetStoreMarkUp(oStoreX, nStoreSellX); PrintToLog("STORE_INVESTMENT - Merchant Closed: " + GetTag(oStoreX) + ". Store Values: " + IntToString(nStoreBuyX) + " vs " + IntToString(nStoreSellX)); } } break; } } }And the output to the logScript STORE_INVESTMENT - Merchant Opened: store_camp_bodahn. Last Merchant: Script STORE_INVESTMENT - Merchant Values (DIALOGUE): -1 vs -1 Script STORE_INVESTMENT - Merchant Values (STATIC): -1 vs -1 Script STORE_INVESTMENT - Merchant Values (STORE GUI): -1 vs -1 Script STORE_INVESTMENT - Merchant Closed: store_camp_bodahn. Store Values: -1 vs -1I am positive the oStore object is valid cause when this script runs the merchant in question will sell and buy with 100% of the value. Am I using the functions wrong or are they simply bugged? -kyoma Link to comment Share on other sites More sharing options...
baracuda6977 Posted February 7, 2010 Share Posted February 7, 2010 markup/markdown are percents which means you will need a float variable to hold them appropriatly i believe Link to comment Share on other sites More sharing options...
KyoParadox Posted February 7, 2010 Author Share Posted February 7, 2010 markup/markdown are percents which means you will need a float variable to hold them appropriatly i believeNo they both return an int value, in fact, using a float only results in an error at compiling due to mismatched types. Link to comment Share on other sites More sharing options...
Recommended Posts