[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Progs, having an end command?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Progs, having an end command?

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Mon 10 Jan 2005 01:22 AM (UTC)  quote  ]
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
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #1 on Mon 10 Jan 2005 07:30 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #2 on Mon 10 Jan 2005 11:12 AM (UTC)  quote  ]
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
[Go to top] top

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

[Go to top] top

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


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



[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #5 on Tue 11 Jan 2005 02:39 AM (UTC)  quote  ]
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
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #6 on Tue 11 Jan 2005 03:03 AM (UTC)  quote  ]
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
[Go to top] top

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

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #8 on Wed 12 Jan 2005 12:22 AM (UTC)  quote  ]
Message
Dont shoot the messenger!
[Go to top] 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.


1,659 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]