Deltagamer163 Posted June 10, 2020 Share Posted June 10, 2020 I'm trying to make a mini-casino in the tops in one of the hotel rooms. It has a custom casino script, and its own chips. I'm trying to make a cashier terminal that will let you pay caps for the chips (which are called RoomChips) and convert RoomChips to Tops Chips, which are cashed in downstairs like normal. The cap -> chip conversion works fine, but there is a problem with converting RoomChips to Tops Chips. When making the script, I accidentally made it pay 1 cap for every RoomChip, and not remove the chips. I placed the terminal into the room, and then looked over my script again. I changed it to make it pay 1 Tops Chip for every 10 RoomChips, and of course remove the RoomChips. The problem is, ingame, the terminal still pays 1 cap for every RoomChip, and doesn't remove the chips. I verified the terminal script was saved with the correct script, replaced the terminal, and the problem still occured. I even tried removing it, loading a save where it wasn't there, and then placing the terminal and loading in again, but the problem persists. Here is the current script if it's needed. I think it might be loading the previous script due to an error with the current code, but I'm unsure. float RoomChipCount set RoomChipCount to (Player.GetItemCount RoomChip) Player.AddItem TheTopsChip (RoomChipCount / 10)Player.RemoveItem RoomChip RoomChipCount Link to comment Share on other sites More sharing options...
dubiousintent Posted June 11, 2020 Share Posted June 11, 2020 "Understand the block types and what functions can and should and can't and should NOT be used in each one. You can easily block thread execution with the wrong function and freeze a quest. Always give your code time to actually work. Many functions take longer than 1 pass (1 frame) to run. If in doubt, create stages and allow your script time to breathe. (See TIP Block Types Multiple vs Single Frame processing.)" - TIP Best Practice Sharing Variables between Scripts. Without the entire script structure, it's difficult to tell. Don't see any obvious syntax problem, but your removal line is stripping away ALL RoomChips, including any remainders (NVSE "modulo") beyond a multiple of ten. I have a recollection that you need a frame or two between adding an item and removing it, but cannot find the explicit reference immediately. But if you are adding RoomChips in the same block, that might be part of the problem. As for the "cap" payout, that seems to be in a different section of the script. -Dubious- Link to comment Share on other sites More sharing options...
UnvalidUserName Posted June 11, 2020 Share Posted June 11, 2020 Try with an integer for RoomChipCount. You will have to accommodate for the extra chips beyond multiples of tens like dubious said Link to comment Share on other sites More sharing options...
Deltagamer163 Posted June 12, 2020 Author Share Posted June 12, 2020 Hm. I'll see if that does anything Link to comment Share on other sites More sharing options...
Deltagamer163 Posted June 12, 2020 Author Share Posted June 12, 2020 "Understand the block types and what functions can and should and can't and should NOT be used in each one. You can easily block thread execution with the wrong function and freeze a quest. Always give your code time to actually work. Many functions take longer than 1 pass (1 frame) to run. If in doubt, create stages and allow your script time to breathe. (See TIP Block Types Multiple vs Single Frame processing.)" - TIP Best Practice Sharing Variables between Scripts. Without the entire script structure, it's difficult to tell. Don't see any obvious syntax problem, but your removal line is stripping away ALL RoomChips, including any remainders (NVSE "modulo") beyond a multiple of ten. I have a recollection that you need a frame or two between adding an item and removing it, but cannot find the explicit reference immediately. But if you are adding RoomChips in the same block, that might be part of the problem. As for the "cap" payout, that seems to be in a different section of the script. -Dubious-Could you put that in layman's terms for me? I'm not very good at understanding code. Link to comment Share on other sites More sharing options...
UnvalidUserName Posted June 12, 2020 Share Posted June 12, 2020 He was asking you to post the entire script Link to comment Share on other sites More sharing options...
KaPks8 Posted June 13, 2020 Share Posted June 13, 2020 If I run into troubles like that, I usually try to load a save were I've never been in the affected cell before, and then go / coc into the cell where I placed the new object. That way, I am trying to make sure, that the game never instantiated any of these objects before, but pulls 'fresh' data from the records, instead of using what it may find in the save from a previous visit to the cell. Link to comment Share on other sites More sharing options...
dubiousintent Posted June 13, 2020 Share Posted June 13, 2020 <snip>Could you put that in layman's terms for me? I'm not very good at understanding code. I can try, but you will have to narrow it down for me. I covered several things in my reply. Which in particular are you having trouble with? It's like I'm trying to help you fix your car over the phone. I can't point to something and say "that's a carburetor and that's a spark plug" if you don't know those terms. Every field of endeavor has it's own terminology you have to learn in order to be able to communicate clearly with anyone else in that field. Coding (programming) is the same way. -Dubious- Link to comment Share on other sites More sharing options...
Deltagamer163 Posted June 14, 2020 Author Share Posted June 14, 2020 I <snip>Could you put that in layman's terms for me? I'm not very good at understanding code. I can try, but you will have to narrow it down for me. I covered several things in my reply. Which in particular are you having trouble with? It's like I'm trying to help you fix your car over the phone. I can't point to something and say "that's a carburetor and that's a spark plug" if you don't know those terms. Every field of endeavor has it's own terminology you have to learn in order to be able to communicate clearly with anyone else in that field. Coding (programming) is the same way. -Dubious- I was confused by the part about block stages. The link you provided was difficult to understand. Link to comment Share on other sites More sharing options...
Deltagamer163 Posted June 14, 2020 Author Share Posted June 14, 2020 He was asking you to post the entire scriptThat was the entire script. Link to comment Share on other sites More sharing options...
Recommended Posts