Ok, so I'm kind of stuck here... I'm trying to make a list container (for equipable items) to hold several values, with each index corresponding to a Stat attribute for users (ie. 1 = Maximum HP, 2 = Strength, 3 = Constitution, etc.). Problem is, when I try to change a value in that list in the obj definitions, I get the error: "error:statmod:left-hand side must be an object variable". Here's a snippet of the that code (note: AFF_MAXHP and HEAD_LAYER are both constant variables):
obj
Equipable
var
sdesc = "(nothing)"
equipped = 0
armorrate = 0
viewlayer = 0
twohand = 0
weapontype = 0
statmod[7]
attack = "0d0"
Armor
Head
BronzeCap
icon = 'bronzecap.dmi'
sdesc = "a bronze cap"
name = "Bronze Cap"
armorrate = 2
statmod[AFF_MAXHP] = 5
viewlayer = HEAD_LAYER
Also, I can reference the indices of statmod outside of the object definition (they're used in calculating the total stats of players). Any help would be greatly appreciated. Thanks!
ID:171309
![]() Oct 15 2004, 10:48 am
|
|
Green Lime wrote:
Igmolicious wrote: Well I just put the code into my DM to see whats going on and I haven't a clue? Basically what its saying is that statmod[] list is made under the object type Equipable and what not. But I guess you can't instarlize the list for another value. Cause it just recognizes it to be a new list or ... Oh I havent a freaking clue only one probley knows is some one like Lummox Jr or the makers of byond. PS: Just insteralize the variables in New() or somthin K |
Yeah, after doing a little searching through the forum here, it appears that that's impossible to initialize members of a list in an object's definition. It appears that using New() is the only way to do this. I think I'll just go about it a different way. Thanks for your time and advice :)
|
Igmolicious wrote:
Yeah, after doing a little searching through the forum here, it appears that that's impossible to initialize members of a list in an object's definition. It appears that using New() is the only way to do this. I think I'll just go about it a different way. Thanks for your time and advice :) you can still use New(), just declair it after you define the vars: obj ok, not based off your code, but hey, I'm just here to help, not write your code... =) |
O.o first off, the line of code in which this occurse would be nice too know. But since I have common sense I'm going to say its statmod[AFF_MAXHP] = 5;
error:statmod:left-hand side must be an object variable
seeings how the left hand side is statmod[AFF_MAXHP] im guessing thats your problem. Now on too what is the problem. Well I got a question are you delcaring AFF_MAXHP to be equal to what ever its equal to globally? Cause I dont see you delcaring what its equal to in the Equipab ... ohh blah blah to much to type!
BYE