ID:263228
 
Code:
         mob
SHOPS
Shop_NPC1
icon = 'green_navi.dmi'
icon_state = "sul"
name = "Shop NPC"
verb
Buy()
if(src.gold >= 0)
set category = "NPC"
set src in oview(3)

// create a list of demo items
var/list/menu = list()
menu += new/obj/Sword_chip()
menu += new/obj/MoonBlade1_chip()
menu += new/obj/Cannon_chip()

// get input
var/obj/input = sd_Input(src, menu, 6, 6, 6, 4,,0)
if(input.type == /obj/Sword_chip/)
var/obj/Sword_chip/SWORDC = new
usr.contents += SWORDC
usr.gold -= SWORDC.cost
if(input.type == /obj/MoonBlade1_chip/)
var/obj/MoonBlade1_chip/MOON = new
usr.contents += MOON
usr.gold -= MOON.cost
if(input.type == /obj/Sword_chip/)
var/obj/Cannon_chip/CANNONC = new
usr.contents += CANNONC
usr.gold -= CANNONC.cost
else
usr<<"You are in debt with us!Go get some money!"


original code:

        itemmenu()
desc = "Input one item from a menu."

// create a list of demo items
var/list/menu = list()
menu += new/obj/cloak()
menu += new/obj/sword()
menu += new/obj/potion()

// get input
var/input = sd_Input(src, menu, 6, 6, 6, 4,,0)
src << "You selected: [input]"


lib used: sd_textV9


Problem description:
runtime error: bad number
proc name: Update (/sd_TextWindow/proc/Update)
source file: sd_Text.dm,1028
usr: Pharaoh Atem (/mob/Player)
src: /sd_TextWindow (/sd_TextWindow)
call stack:
/sd_TextWindow (/sd_TextWindow): Update()
sd Input(Shop NPC (/mob/Reloaded_NPCS/Shop_NPC1), /list (/list), 6, 6, 6, 4, 1, 0, 5, 'charset.dmi', 'window50.dmi', 'scrollarrows.dmi')
Shop NPC (/mob/Reloaded_NPCS/Shop_NPC1): Buy()


HEEEEELP =(~~

I have no clue which line the error is on since you didn't say which it was but if I had to guess it would be this line because you skipped an arguement like you did..

var/obj/input = sd_Input(src, menu, 6, 6, 6, 4,,0)


Fill that argument in and it should fix it, or maybe you just accidentally added an extra comma.

-Exophus
You should really lose those if() statements.
input.loc = usr
usr.gold -= input.cost
In response to Papoose
> input.Move(usr)
>


reloaded_NPCS.dm:43:error:Move :invalid expression
In response to Pharaoh Atem
Sorry about that, I forgot about that little bug with variables by the name of input.
input.loc = usr
In response to Papoose
Papoose wrote:
Sorry about that, I forgot about that little bug with variables by the name of input.
input.loc = usr



runtime error: bad number
proc name: Update (/sd_TextWindow/proc/Update)
source file: sd_Text.dm,1028
usr: Pharaoh Atem (/mob/Player)
src: /sd_TextWindow (/sd_TextWindow)
call stack:
/sd_TextWindow (/sd_TextWindow): Update()
sd Input(Shop NPC (/mob/Reloaded_NPCS/Shop_NPC1), /list (/list), 6, 6, 6, 4, 1, 0, 5, 'charset.dmi', 'window50.dmi', 'scrollarrows.dmi')
Shop NPC (/mob/Reloaded_NPCS/Shop_NPC1): Buy()


        Update()
var/currentline = offset
var/obj/Obj = new()
for(var/atom/movable/I in ScrollList)
Client.screen -= I
var/end = 0
for(var/V in 1 to height)
if(currentline > Lines.len)
currentline = 0
end = 1
var/list/List = list()
for(var/H in 1 to width)
var/atom/O = Pieces[V][H]
O.overlays = list()
O.icon_state = ""
List += O

var/atom/movable/sd_WindowPiece/Left = List[1]
Left.line1 = currentline
Left.line2 = 0

if(currentline)
if(istext(Lines[currentline]))
sd_OverlayText(Lines[currentline], List, Layer, 1, 0, Charset[currentline])
currentline++
if(currentline > Lines.len)
currentline = 0
end = 1
else if(istext(Lines[currentline]))
sd_OverlayText(Lines[currentline], List, Layer, 0, 0, Charset[currentline])
Left.line2 += currentline
currentline++

else if(istype(Lines[currentline],/atom))
var/atom/Atom = Lines[currentline]
Obj.icon = Atom.icon
Obj.dir = Atom.dir
Obj.icon_state = Atom.icon_state
Obj.layer = Layer
Obj.overlays = Atom.overlays
Left.overlays += Obj
AtomImage(Atom,Left)
List -= Left
sd_OverlayText(Atom.name, List, Layer, 1, 0, Charset[currentline])
sd_OverlayText(Atom.suffix, List, Layer, 0, 0, Charset[currentline])
Left.line2 = currentline
currentline++

else
Left.line2 = 0
var/state = 0
if(num2text(Left.line1) in select) state++
if(num2text(Left.line2) in select) state += 2
if(state)
for(var/atom/A in List)
A.icon_state = num2text(state)

if(ScrollList.len)
if(offset > 1) Client.screen += ScrollList[1]
if(!end)
Client.screen += ScrollList[2]
In response to Pharaoh Atem
You should tell us which line number 1028 is... >_>

-Exophus
In response to Exophus
Exophus wrote:
You should tell us which line number 1028 is... >_>

-Exophus

            for(var/V in 1 to height)
In response to Pharaoh Atem
I don't think you can do that, hence the run-time. in 1 to width..? If that's anything close to what I think it is then this should work.

for(var/a=1,a<=width,a++)


Same for the length one.

-Exophus
In response to Exophus
Exophus wrote:
I don't think you can do that, hence the run-time. in 1 to width..? If that's anything close to what I think it is then this should work.

for(var/a=1,a<=width,a++)

Same for the length one.

-Exophus

where should i put this?
In response to Exophus
Exophus wrote:
I don't think you can do that, hence the run-time. in 1 to width..? If that's anything close to what I think it is then this should work.

for(var/a=1,a<=width,a++)

Same for the length one.

-Exophus

runtime error: list index out of bounds
proc name: Update (/sd_TextWindow/proc/Update)
source file: sd_Text.dm,1034
usr: Pharaoh Atem (/mob)
src: /sd_TextWindow (/sd_TextWindow)
call stack:
/sd_TextWindow (/sd_TextWindow): Update()
sd Input(Pharaoh Atem (/mob), /list (/list), 6, 6, 6, 4, 1, 0, 5, 'charset.dmi', 'window50.dmi', 'scrollarrows.dmi')
Pharaoh Atem (/mob): itemmenu()

I edited the lib, then appeared this error.When I run my game and I try to buy something, nothing happens :/
Help me plz!
        Update()
var/currentline = offset
var/obj/Obj = new()
for(var/atom/movable/I in ScrollList)
Client.screen -= I
var/end = 0
for(var/V=1,V<=width,V++)
if(currentline > Lines.len)
currentline = 0
end = 1
var/list/List = list()
for(var/H=1,H<=width,H++)
var/atom/O = Pieces[V][H]
O.overlays = list()
O.icon_state = ""
List += O
In response to Pharaoh Atem
Hmm... Maybe it should be a<width instead of a<=width. Try that instead. And is width a list or a number? Because if it is a list then that could be a problem. I would assume width is a number but, who knows except you?

-Exophus
In response to Exophus
Exophus wrote:
Hmm... Maybe it should be a<width instead of a<=width. Try that instead. And is width a list or a number? Because if it is a list then that could be a problem. I would assume width is a number but, who knows except you?

-Exophus

http://developer.byond.com/hub/Shadowdarke/sd_Text
I use this lib =P
            for(var/V=1,V<width,V++)
if(currentline > Lines.len)
currentline = 0
end = 1
var/list/List = list()
for(var/H=1,H<width,H++)
var/atom/O = Pieces[V][H]
O.overlays = list()
O.icon_state = ""
List += O


the same runtime error :/