Jump to content

Refining Device Script Help


kieranfoy

Recommended Posts

Right, I'm working on a mod that, in part, allows one to mine a resource called Raw Warpstone. I'm hoping to allow the player to refine the warpstone but for that I need...

 

This:

 

A script that, when a switch is flipped, will bring up the following menu:

 

What would you like to make?

 

Powdered Warpstone?

 

Refined Warpstone?

 

And the scritp would detect how many of the item 1warpstoneraw was in the container, remove them, and replace them with the selected item at the following rate:

 

Powdered warpstone: 10 of 1warpstoneraw The item's code is 1warpstonepowder

 

Refined warpstone: 20: the code of the item is 1warpstone refined

 

If there weren't enough, a message would pop up saying "You need more warpstone!"

 

Is this do-able? Can you offer me some help, keeping in mind that I need things spelled out, being a n00b?

 

I'll gladly offer kudos and credit!

Link to comment
Share on other sites

I'm not sure.. Is division possible for scripts?

 

Otherwise, one could just use if ().getitemcount () == 10, additem () 1, etc. Up to about 150 or so, assuming there's an upper limit to how many stones you can have or can produce at a time.

Link to comment
Share on other sites

Okay, in that case I'll write out a script that'll be able to produce up to 5 at a time (50 ingots)

 

scn (Scriptname)

ref self
short button
short button2
short button3
short itemcount

begin OnActivate
set self to getself
player.messagebox "What would you like to make?", "Powdered Warpstone", "Refined Warpstone"
set button to getbuttonpressed
end

begin gamemode
if button == 0
player.messagebox "How many would you like to make?", "1 (10 Raw Warpstone)", "2 (20 Raw Warpstone)", "3 (30 Raw Warpstone)", "4 (40 Raw Warpstone)", "5 (50 Raw Warpstone)", "Nevermind"
set button2 to getbuttonpressed

if button2 == 0 && self.getitemcount 1warpstoneraw >= 10
self.removeitem 1warpstoneraw 10
self.additem 1warpstonepowder 1
elseif button2 == 0 && self.getitemcount 1warpstoneraw < 10
player.message "There's not enough raw warpstone to create that."
return

if button2 == 1 && self.getitemcount 1warpstoneraw >= 20
self.removeitem 1warpstoneraw 20
self.additem 1warpstonepowder 2
elseif button2 == 1 && self.getitemcount 1warpstoneraw < 20
player.message "There's not enough raw warpstone to create that."
return

if button2 == 2 && self.getitemcount 1warpstoneraw >= 30
self.removeitem 1warpstoneraw 30
self.additem 1warpstonepowder 3
elseif button2 == 2 && self.getitemcount 1warpstoneraw < 30
player.message "There's not enough raw warpstone to create that."
return

if button2 == 3 && self.getitemcount 1warpstoneraw >= 40
self.removeitem 1warpstoneraw 40
self.additem 1warpstonepowder 4
elseif button2 == 3 && self.getitemcount 1warpstoneraw < 40
player.message "There's not enough raw warpstone to create that."
return

if button2 == 4 && self.getitemcount 1warpstoneraw >= 50
self.removeitem 1warpstoneraw 50
self.additem 1warpstonepowder 5
elseif button2 == 4 && self.getitemcount 1warpstoneraw < 50
player.message "There's not enough raw warpstone to create that."
return

if button2 == 5
return



if button == 1
player.messagebox "How many would you like to make?", "1 (20 Raw Warpstone)", "2 (40 Raw Warpstone)", "3 (60 Raw Warpstone)", "4 (80 Raw Warpstone)", "5 (100 Raw Warpstone)", "Nevermind"
set button2 to getbuttonpressed

if button3 == 0 && self.getitemcount 1warpstoneraw >= 20
self.removeitem 1warpstoneraw 20
self.additem 1warpstonerefined 1
elseif button3 == 0 && self.getitemcount 1warpstoneraw < 20
player.message "There's not enough raw warpstone to create that."
return

elseif button3 == 1 && self.getitemcount 1warpstoneraw >= 40
self.removeitem 1warpstoneraw 40
self.additem 1warpstonerefined 2
elseif button3 == 1 && self.getitemcount 1warpstoneraw < 40
player.message "There's not enough raw warpstone to create that."
return

if button3 == 2 && self.getitemcount 1warpstoneraw >= 60
self.removeitem 1warpstoneraw 60
self.additem 1warpstonerefined 3
elseif button3 == 2 && self.getitemcount 1warpstoneraw < 60
player.message "There's not enough raw warpstone to create that."
return

if button3 == 3 && self.getitemcount 1warpstoneraw >= 80
self.removeitem 1warpstoneraw 80
self.additem 1warpstonerefined 4
elseif button3 == 3 && self.getitemcount 1warpstoneraw < 80
player.message "There's not enough raw warpstone to create that."
return

if button3 == 4 && self.getitemcount 1warpstoneraw >= 100
self.removeitem 1warpstoneraw 100
self.additem 1warpstonepowder 5
elseif button3 == 4 && self.getitemcount 1warpstoneraw < 100
player.message "There's not enough raw warpstone to create that."
return

if button3 == 5
return

endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
end

 

My brains hurts and so do my fingers.

 

Anyways, that code most likely won't work, and I assume I screwed up several times in it somewhere. Can we get a coder who knows what they're talking about to check this over?

Link to comment
Share on other sites

Wow... now that is some fancy scripting. Thank you so much, man.

 

When I input it, it whinges about there being too many nesting, but I'll be able to work out the kinks. Thank you!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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