Is there anyway in OLC, in progs, do make a command (like return) that'll end the prog? If so, how would it be done?
Progs, having an end command?
Posted by Zeno on Mon 10 Jan 2005 01:22 AM — 9 posts, 26,801 views.
Doesn't such a thing already exist? I think the codebase I have does have such a thing, but I have no idea if it was there by default or somebody before me put it there.
In any case, I imagine that if it doesn't, you could always do it in the program interpreter, by simply exiting the loop as soon as you hit an instruction of that form. For instance, look at the code for parsing an if statement; then, simply make something just like that but instead of recognizing 'if' you recognize 'end' or 'return' or whatever you want to call it. (I think 'end' is more accurate because you're not returning anything at all, ever.) Then, you'd just exit the processing loop. I think that it's actually not that hard at all.
In any case, I imagine that if it doesn't, you could always do it in the program interpreter, by simply exiting the loop as soon as you hit an instruction of that form. For instance, look at the code for parsing an if statement; then, simply make something just like that but instead of recognizing 'if' you recognize 'end' or 'return' or whatever you want to call it. (I think 'end' is more accurate because you're not returning anything at all, ever.) Then, you'd just exit the processing loop. I think that it's actually not that hard at all.
Not that I know of. I was asked by my Head Builder to put it in, and as far as I know with Smaug OLC, I've never heard of it. I'll look it over, see what I can find.
Are you refering to endif and break?
So if you have this in a mobprog:
if hasobj($n) == sword
mpechoat 'Valens is dumb'
else
break
endif
Yeah thats it, funny how none of us knew about that. Doesn't seem to be in any helpfiles.
I was pretty sure there was something in there already, but are you sure it's break out from the whole program and not just the if block? (although I suppose that wouldn't make a lot of sense, would it...)
Nah, it's a total break of the whole program.
Dont shoot the messenger!