Hiya! I've been making a pretty cool RPG, but when doing the magic system, i got whacked by an error even i cant fix.
This code doesn't seem to work... i've tried every variation to it too. nothing can fix this dying monster.
var/spell_use=input("Which spell do you want to use?") in list(P.spells)
Basiclly what happens (This is inside a proc, so go with it.) is when it gets to this line. the input screen never pops up. DM doesn't even give me an error. the thing just stops!
I'd really appreciate some help.
P.S. If you need more code to understand, pls tell me
ID:172393
![]() May 18 2004, 1:35 pm
|
|
Well, that sounds like it would work
*Goes and tries* Nope... that didn't do it. BTW i made sure P was the usr, and usr was P, it just doesen't want to display the list... However. when i turned input into an alert var/spell_use=alert(P,"Which spell do you want to use?",,P.spells) it reaveals to me the whole list in one box. the box doesn't do anything but close the window however when i click it (thats cause be if() statement afterwards.) |
You already(or should already) have spells defined as a list. list(P.spells) is making a new list and putting the spells list in it. Just use P.spells.
|
oh, yeah... i already tried that but it didn't work either.
[that is, if you were talking about this] var/spell_use=input(P,"Which spell do you want to use?")in P.spells |
I ran a test and it worked fine, maybe the problem lies elsewhere?
Test: mob/var/spells=list("Fire","Blizzard","Thunder") |
Hey.... i found out why it wasn't working, but still ned some help on the reason.
my defining of spells var was mob/var/spells however, when i changed it to... mob/var/spells=list() it started working, anyone have any clues as to why this var worked when my old one didn't? |
Redslash wrote:
Hey.... i found out why it wasn't working, but still ned some help on the reason. Because you never initialized the old one. It was null, and didn't even know it was supposed to be a list type. However, this is the wrong way to initialize a list belonging to a mob. The correct way to initialize this list is to do it in mob/New() or whenever you'll need it. // better Lummox JR |
LummoxJR
When i try that, gives me a "missing left hand argument" to the if statement. am i susposed to put who ever is gaining the spells in there or what? |
Redslash wrote:
LummoxJR My guess is you integrated the code in a way different from what I showed you. I'd have to see the line that's the problem. Lummox JR |
input("Which spell do you want to use?") is *really* input(usr, "Which spell do you want to use?")
Try making it
input(variableOfThePlayer, "Which spell do you want to use?")