ID:272720
 
I want to use a proc as a "check", if you will, so that if it returns false, a verb will discontinue with the rest of its coding, much like a return.
Simple..

proc/Check()
if(prob(60)) return TRUE
// procs return false by default

mob/verb/Doodly_doodly_doo() // <_<
world << "Will it be possible ? Will the world be saved from total domination ?!"
if(!Check()) return
world << "Success!"


You just need to check if the value the proc returns is true or false.
In response to Andre-g1 (#1)
I figured as much. Now for the other issue that made me unsure...

world
mob = /mob/Player

mob/Player/var
tmp/isAway = FALSE

mob/proc/failCheck()
if(src.isAway)
return 0

mob/verb
Test()
if(failCheck()) return
usr<<"This is not supposed to be displayed"


General Procs.dm:29:error:src.isAway:undefined var

I know it has to do with the fact that I made the players' typepath to /mob/Player, but I don't know how to make it so the procs and verbs read it like that too.
In response to Mizukouken Ketsu (#2)
-First change your failCheck() proc, so it's under mob/Player.

--Secondly, reading my post would be nice. A proc returns false by default, so why'd you make it return 0 ? 0 is considered a FALSE value. Also, if you're returning FALSE values, why are you checking if the return value of the proc is true ? Makes no sense at all.

Afterwards, since you're checking the src in the failCheck() you need to pass the mob onto the proc. So, if(failCheck()) should actually be if(!usr.failCheck()).
In response to Andre-g1 (#3)
mob/Stuff/verb
Test()
if(!failCheck()) return


Stuff.dm:20:error:failCheck:undefined proc
In response to Mizukouken Ketsu (#4)
Read the bottom part of my post...
In response to Andre-g1 (#5)
Why do people like to assume I "didn't read all of my post". I did. Still didn't work. Said same exact thing. Help now, please?

EDIT
Nevermind, I figured it out.
In response to Mizukouken Ketsu (#6)
Mizukouken Ketsu wrote:
Why do people like to assume I "didn't read all of my post".

Because you didn't use the way I told you to. I just tested with your snippet and it worked fine the way I told you.
In response to Andre-g1 (#7)
Well it didn't work for me, sorry. However, I did find a way for it to work. Thanks anyways.
In response to Andre-g1 (#3)
Andre-g1 wrote:
--Secondly, reading my post would be nice. A proc returns false by default, so why'd you make it return 0 ? 0 is considered a FALSE value. Also, if you're returning FALSE values, why are you checking if the return value of the proc is true ? Makes no sense at all.

It's done often to indicate, explicitly, that the proc needs to return false. This is contrasting using return simply to indicate the proc is halting.