obj/rod
icon = 'objs.dmi'
icon_state = "rod"
turf/water
var/randvar = 0
verb
fish()
set src in view(1)
if(locate(obj/rod) in usr.contents)
if(rand(1,100)<=src.randvar)
usr <<"You catch a fish"
new/obj/rod(usr)
else
usr <<"You fail to catch a fish!!"
else
usr <<"You need a rod before you can fish!"
errors: loading Life.dme
Skills.dm:14:error:view:undefined proc
Skills.dm:15:error:obj:undefined var
Skills.dm:15:error:rod:undefined var
Skills.dm:15:error::invalid expression
Life.dmb - 4 errors, 0 warnings (double-click on an error to jump to it)
.Whys this?
ID:178132
Jun 16 2002, 12:48 am
|
|
In response to Garthor
|
|
turf/water
var/X = 0 verb fish() set src in view(1) for(var/obj/rod/R in usr) if(istype(R,/obj/rod) X = 1 break if(X) usr <<"You catch a fish!" new/obj/fish(usr) else usr <<"You fail to catch anything!" else usr <<"You need a rod" errors: loading Life.dme Skills.dm:16:error: X: missing comma ',' or right-paren ')' Life.dmb - 4 errors, 0 warnings (double-click on an error to jump to it) |
In response to ShadowSiientx
|
|
..............
|
In response to ShadowSiientx
|
|
That error means you're missing a ). Look on the line it shows the error on and count the nubmber of ('s and )'s (or maybe the line above it, I forget which line it displays the error on)
|
I just wanted to give you a different version of fishing that I think might be a little better.
obj/fish big icon = 'big.dmi' medium icon = 'medium.dmi' small icon = 'small.dmi' obj/rod icon = 'rod.dmi' turf/water icon = 'water.dmi' verb/Fish() set src in oview(1)//use whatever view you would like usr << "You cast out the rod." sleep(30)//sleep for 3 seconds usr << rand(prob(100);"You catch a big fish",prob (75);"You catch nothing")and so on if("You catch a big fish") new /obj/fish/big(usr) ans so on NOTE: you can change the prob() for each one accordingly, the higher it is the less likely of a chance that has of popping up, then just simply add more fish as you update the game.(I hope that works) |
ShadowSiientx wrote:
obj/rod I will give you an explanation. You don't need to tab after setting src. Also use the Find() proc to search list so, usr.contents.Find(/obj/rod). With out/ its not a path and so thats what gives problems. |
In response to Garthor
|
|
turf/water
var/X = 0 verb fish() set src in view(1) for(var/obj/rod/R in usr) if(istype(R,/obj/rod) X = 1 break if(X) usr <<"You catch a fish!" new/obj/fish(usr) else usr <<"You fail to catch anything!" else usr <<"You need a rod" The x is the problem.. |
In response to ShadowSiientx
|
|
indent the X = 1 part
|
In response to Garthor
|
|
obj/rod
icon = 'objs.dmi' icon_state = "rod" obj/fish icon = 'objs.dmi' icon_state = "fish" turf/water var/X = 0 verb fish() set src in view(1) usr.contents.Find(/obj/rod) X = 1 break if(X) usr <<"You catch a fish!" new/obj/fish(usr) else usr <<"You fail to catch anything!" else usr <<"You need a rod" ok, now heres the errors? loading Life.dme Skills.dm:16:error:break :not in a loop. Skills.dm:22:error:else :'else' clause without preceding 'if' statement Life.dmb - 2 errors, 0 warnings (double-click on an error to jump to it) |
In response to ShadowSiientx
|
|
I suggest actually looking up for() in the reference because you're using it totally wrong.
|
var/X = 0
for(var/obj/rod/R in usr) if(istype(R,/obj/rod)
X = 1
break
if(X)
...Fishing code
else
...need a rod