ID:143600
 
Problem description:

I defined a proc like this..

proc/Sandwall(mob/M)
M.chakra -= 5000


Then had a verb to use it. It went through a few checks to make sure you could use the attack, and your not currently using another attack.

            else
Sandwall(usr)


Thats how it was called, and I dont think I need to post the whole code but if I need to let me know. But the check ran fine. It stopped it when it was supposed to and such. But when it got down to calling the proc itself it just shut down the whole game.

The proc I showed isnt the whole proc, it might be something in it, and I'll keep rechecking through it, but im wondering if the way the proc was called should be different. Should it be a mob/proc/Sandwall(mob/M) or something like that?.. I just wanted to try something different because I always seem to get some conflict with the variable defined and the "src" in a mob proc.
it should be mob/proc/Sandwall(mob/M) I believe, im still kinda new to coding, but that looks like the problem
In response to Aaiske Productions
Procs can still be defined as proc/Sandwall(mob/M) and I have a few demos in my game that demonstrate this. I just can't seem to make my own proc using this method
In response to SS10trunks
well proc/ would be atom, which is more like a world proc, was just saying try mob/proc
In response to Aaiske Productions
I know it CAN be used, I just always seem to get some conflict with a src and the variable i define as the mob. The proc gets them confused. Maybe I'm coding it clumsily or something, but I'm just trying to find a more efficient way of making procs to suit my personal coding style
In response to SS10trunks
You have an infinite loop going there. If it always returns false, that else statement will repeatedly called Sandwall, which will lead to an infinite loop, and ultimately crashing the server. You need to either spawn() the recall of Sandwall, or place a sleep() before calling it again. Even sleep(1) would keep it from crashing.
In response to Pyro_dragons
Pyro_dragons wrote:
You have an infinite loop going there. If it always returns false, that else statement will repeatedly called Sandwall, which will lead to an infinite loop, and ultimately crashing the server. You need to either spawn() the recall of Sandwall, or place a sleep() before calling it again. Even sleep(1) would keep it from crashing.

sleep() won't fix his problem like spawn() will, because the proc is calling itself. Any proc that does this needs to use spawn(), unless the actual goal is to recurse. Otherwise the stack will overflow.

When a proc calls itself without using spawn(), it waits for an answer. This is useful for procs that are meant to be recursive, like some search algorithms, but for any case where you want a simple loop, you should just use a proper loop (with sleep() in it) or use spawn() to call the proc.

Lummox JR