Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ninekorn

#226
discontinued 2023 july 29th . by ninekorn
#227
discontinued 2023 july 29th . by ninekorn
#228
Help section / How to use ship.SetEquipmentCacheValue?
August 01, 2017, 08:15:16 PM
discontinued 2023 july 29th . by ninekorn
#229
discontinued 2023 july 29th . by ninekorn
#230
Ok! Tested it and it works! Thanks. I can now buy items in the whole galaxy. The items go in the player storage Inside the station where the item was bought and 1 item is removed from the station themselves.
#231
Hi,

The Scripting API doesnt seem to recognize items.RemoveItem not recognized as a function! I've also tried station.RemoveItem or generator.RemoveItem or game.RemoveItem but none seem to work. items.RemoveCargo won't work because im trying to remove items from the station shop container. This is for my galaxy market mod.

Thank you in advance.
nine
#232
discontinued 2023 july 29th . by ninekorn
#233
thank you. in the end i was the one that had gone to sleep. had a big day yesterday. Ill try that out today.
#234
Hey AI-Enable. If youre still working could I know how to access items from "itemsInCargo = items.GetItemsAndCargo(shop_container_id)". This gives me an array of objects. but nowhere i can find in the scripts how to go get the difference shop sections like "boosters" "devices" "hulls" etc. When I write a for loop to try and get them i get [object object] and when i do a double for loop to iterate through itemsInCargo[g] I get nothing. again. thats probably my lack of knowledge of javascript but still theres no explanation for that in the Scripting API unless I just didnt find it. You see Im creating this market Terminal where players will be able to access every shops in each system the moment they access that terminal. Right now I can select systems then stations then I get the "main" station container i guess then I thought I would get the different sections of the shops with that GetItemsAndCargo function. But it just returns "object object" all the time. Once I get those items I will incorporate buy/sell for the player to buy items from the other side of the galaxy. Im not there yet.

something like:

"itemsInCargo = items.GetItemsAndCargo(shop_container_id)".

for (i = 0; i < itemsInCargo.length; i++)
{
       console.Print(itemsInCargo[i]+ " " + " SHOPCONTAINERID");
}
then i dont know what?

#235
wow. it works. ive never used this type of iteration in c#. I didnt knew it even existed in javascript. thank you. I can now move on to getting the containers of the station.

Thanks again! your experience at coding shows. Ok i found the button for quoting scripts.
#236
 mmm. still not working. Ill keep searching for a solution.             

                systemList = generator.GetAllSystems();

      for (var i = 0; i< systemList.length;i++)
      {
         if (game.GetSystemBases(systemList) == !/\S/
         || game.GetSystemBases(systemList) == null
         || game.GetSystemBases(systemList) == " "
         || game.GetSystemBases(systemList) == ""
         || game.GetSystemBases(systemList) == undefined
         || game.GetSystemBases(systemList) == "undefined")
         {
            var indexToRemove0 = systemList.indexOf(systemList); ---- with dual closing brackets with i of course.
            systemList.splice(indexToRemove0,1);
         }

         var tempBasesArray = game.GetSystemBases(systemList); ---- with dual closing brackets with i of course.
         if (tempBasesArray.length === 0 || tempBasesArray.length == 0)
         {
            var indexToRemove0 = systemList.indexOf(tempBasesArray);
            systemList.splice(indexToRemove0,1);
         }
      }


EDIT: so weird. I must be doing something wrong because its still not working with this.

for (var i = 0; i< systemList.length;i++)
      {
         if (game.GetSystemBases(systemList) == !/\S/
         || game.GetSystemBases(systemList) == null
         || game.GetSystemBases(systemList) == " "
         || game.GetSystemBases(systemList) == ""
         || game.GetSystemBases(systemList) == undefined
         || game.GetSystemBases(systemList) == "undefined")
         {
            var indexToRemove0 = systemList.indexOf(systemList);---- with dual closing brackets with i of course.
            systemList.splice(indexToRemove0,1);
         }

         var tempBasesArray = game.GetSystemBases(systemList);---- with dual closing brackets with i of course.

         console.Print(tempBasesArray.length + " " + " stationListArray");

         if (tempBasesArray.length === 0 || tempBasesArray.length == 0)
         {
            if (tempBasesArray == systemList)    ---- with dual closing brackets with i of course.
            {
               var indexToRemove0 = systemList.indexOf(systemList);---- with dual closing brackets with i of course.
               systemList.splice(indexToRemove0,1);         
            }         
         }
         
      }
#237
 i had tried it in the past but it didnt work for some reasons. weird. Ill try it again. maybe i had done a typo or something. Thank you for pointing the solution out.
#238
I've still got a problem trying to remove from the array all systems that have no stations. I know this is more related to Scripting knowlege but if you can help. It's for a new mod. So I have tried a lot of different functions and this one seems to almost be working but doesnt remove some systems that have no stations. I don't really understand why.

i could also put in game.GetSystemBases(systemList) != null && game.GetSystemBases(systemList) != undefined
it seems that the systems that have no stations are still logged as strings or something Inside the game.GetSystemBases function. its just weird. Im gonna keep trying some stuff but if anyones got any ideas I might be able to release this mod tonight. I gotta work hard though. Theres lots of stuff left to do in it.

                 for (var i = 0; i< systemList.length;i++)
      {
         if (game.GetSystemBases(systemList) == !/\S/)
         {
            var indexToRemove0 = systemList.indexOf(systemList);
            systemList.splice(indexToRemove0,1);
         }
      }

Edit: I tried
    game.GetSystemBases(systemList) == !/\S/
|| game.GetSystemBases(systemList) !=null
|| game.GetSystemBases(systemList) != " "
|| game.GetSystemBases(systemList) != "" 

but still got systems that are not beeing remove from the splice Method. Im still searching.

#239
ok I will definitely look into it
#240
wow Notepad++ is powerful. I found itérations of items.GetStationShopContainerId in the StarTrek mod files package. I will look into it! Thank you very much for this hint i know what tool to use now to search. I was typing ctrl+F Inside each script lol much needed upgrade ;D