Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Progs, having an end command?

Progs, having an end command?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zeno   USA  (2,871 posts)  Bio
Date Mon 10 Jan 2005 01:22 AM (UTC)
Message
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?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 10 Jan 2005 07:30 AM (UTC)
Message
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.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Mon 10 Jan 2005 11:12 AM (UTC)
Message
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.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Frobozz   (75 posts)  Bio
Date Reply #3 on Tue 11 Jan 2005 01:36 AM (UTC)
Message
Are you refering to endif and break?

Top

Posted by Frobozz   (75 posts)  Bio
Date Reply #4 on Tue 11 Jan 2005 01:37 AM (UTC)
Message
So if you have this in a mobprog:


if hasobj($n) == sword
  mpechoat 'Valens is dumb'
 else
  break
endif



Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #5 on Tue 11 Jan 2005 02:39 AM (UTC)
Message
Yeah thats it, funny how none of us knew about that. Doesn't seem to be in any helpfiles.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #6 on Tue 11 Jan 2005 03:03 AM (UTC)
Message
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...)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #7 on Tue 11 Jan 2005 03:32 AM (UTC)
Message
Nah, it's a total break of the whole program.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Frobozz   (75 posts)  Bio
Date Reply #8 on Wed 12 Jan 2005 12:22 AM (UTC)
Message
Dont shoot the messenger!
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


23,723 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.