Jump to content

Script Problem


Stewb

Recommended Posts

Sorry for my screw-up posting this last time, i never realised how big my script was....

 

Anyways i upload a txt file with the script this time, so you should be able to hit the reply button this time :)

 

Hi, i have a problem with my script that i can't work out. Basically it should count the amount of items you wish to turn into scrap metal and give you the relevant amount back and also take all of the item to be scrapped. I've had numerous bugs with it, First people have reported to me when using my mod that it gives the correct amount of scrap metal but only takes one of the intended item (which should be impossible as it is the same Short string for both item removal and item receiving). The second bug is one i encounter myself, it takes the correct amount of items but gives the amount of scrap that the last item gave. I.e i scrapped 50 irons for 250 scrap metal, then scrapped 3 tin cans and still got 250 scrap metal, when i should of got 3 scrap metal.

 

The problem i wrote in the last post, hope someone can reply this time :)

Think i'm gonna use Pre-view Post button more now :D

Link to comment
Share on other sites

Hi,

I think I've seen something wrong.

But in any case I am not sure because this script is very long and difficult to read.

 

For the first bug, you don´t use the same short with all RemoveItem commands. Perhaps one of the variables are configured to zero.

Could you specify which objects are those that give the error?

 

For the second bug, when you use the command Set to save a value, it store only the last value.

So when you press the button IRON, the AmmoRe variable store the value Ammo1*5.

But when you prees the button TC (the number 7), I don´t see nowhere that you set again the AmmoRe variable. So AmmoRe remains Ammo1*5.

Link to comment
Share on other sites

Thx, i think that may be it, i will try it out. One thing though, The Ammo1 is Set up at the Scrap Amount Choice Menu, sorry, i know its long, i'll find the revelant bit and try posting it in a codebox for you to see. Looking at it, i probably just forgot to replace AmmoRe with Ammo1 for button 6 onward :wallbash: The rest i just forgot the Set AmmoRe... :wallbash: Thx, guess i'm getting a lil senile in my mid 20s :P

 

;Amount Choice Scrap
if button1c == -1
set button1c to GetButtonPressed
if button1c == 1
	Set Ammo1 to 1
	Set AmmoAll to 0
	ShowMessage SchematicsWorkbenchAmmo3aMsg
	Set button5 to -1
	return
elseif button1c == 2
	Set Ammo1 to 10
	Set AmmoAll to 0
	ShowMessage SchematicsWorkbenchAmmo3aMsg
	Set button5 to -1
	return
elseif button1c == 3
	Set Ammo1 to 1
	Set AmmoAll to 1
	ShowMessage SchematicsWorkbenchAmmo3aMsg
	Set button5 to -1
	return
endif
endif

 

; Scrap Metal
if ( button5 == -1)
Set button5 to GetButtonPressed
; Iron
if button5 == 1
	if (player.GetItemCount Iron >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount Iron)
		EndIf
		player.removeitem Iron Ammo1 1
		Set AmmoRe to (Ammo1*5)
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount Iron
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; TPO
elseif button5 == 2
	if (player.GetItemCount ToasterPostWar >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount ToasterPostWar)
		EndIf
		player.removeitem ToasterPostWar Ammo1 1
		Set Ammo1 to (Ammo1*3)
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount ToasterPostWar
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; TPR
elseif button5 == 3
	if (player.GetItemCount ToasterPreWar >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount ToasterPreWar)
		EndIf
		player.removeitem ToasterPreWar Ammo1 1
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount ToasterPreWar
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; Nuka
elseif button5 == 4
	if (player.GetItemCount NukaTruck >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount NukaTruck)
		EndIf
		player.removeitem NukaTruck Ammo1 1
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount NukaTruck
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; Pot
elseif button5 == 5
	if (player.GetItemCount BigPot >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount BigPot)
		EndIf
		player.removeitem BigPot Ammo1 1
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount BigPot
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; BTC
elseif button5 == 6
	if (player.GetItemCount TinCan02 >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount TinCan02)
		EndIf
		player.removeitem TinCan02 Ammo1 1
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount TinCan02
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; TC
elseif button5 == 7
	if (player.GetItemCount TinCan01 >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount TinCan01)
		EndIf
		player.removeitem TinCan01 Ammo1 1
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount TinCan01
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; MCPo
elseif button5 == 8
	if (player.GetItemCount PotCookingMetal >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount PotCookingMetal)
		EndIf
		player.removeitem PotCookingMetal Ammo1 1
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount PotCookingMetal
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
; MCPa
elseif button5 == 9
	if (player.GetItemCount PanCookingMetal >= Ammo1)
		If AmmoAll == 1
			Set Ammo1 to (player.GetItemCount PanCookingMetal)
		EndIf
		player.removeitem PanCookingMetal Ammo1 1
		player.additem SpareParts AmmoRe
	else
		set item1 to player.GetItemCount PanCookingMetal
		ShowMessage SchematicsWorkbenchFailureMetalMsg, item1
	endif
endif
endif

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...