Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Today, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Google, DotBot, Yandex, Yahoo!, Sogou

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » LoP Codebase » Mprog
Forum Rules | Mark all | Recent Posts

Mprog
< Newer Topic :: Older Topic > Minor problem with mprogs

Pages:<< prev 1 next >>
Post is unread #1 Feb 23, 2010, 4:50 am
Go to the top of the page
Go to the bottom of the page

Legaeldan
Fledgling
GroupMembers
Posts10
JoinedMay 18, 2009

Well, maybe it's just me, but I have this small mob prog that is just driving me a little nutty.
As far as I can see, it all works fine. But I'm still getting a bug error.

Bug: [*****] BUG: Mob #701: Found else in an else section.


The program still works, but this bug report is just driving me a little nuts.
Here's the code for the prog.
3>all_greet_prog 100
if ispc($n)
if isimmort($n)
if name($n) == Aster
Say Greetings Aster, Creator of the Omniverse
else
say Greetings Immortal. How fare thee on this fine day?
endif
else
if sex($n) == 0
say Greetings, Creation of Legaeldan.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
else
if sex($n) == 1
Say Greetings Son of Aster.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
else
if sex($n) == 2
say Greetings Daughter of Silvanyis.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
endif
endif
else
say Greeting creature of the realm.
endif
endif
endif


If anyone has a solution t this it would be great. Will be able to sleep better then. :biggrin:

Oh, also, this is what's happening at the time of the report.

Erewen arrives from below.
Aster's Assistant says ' Greetings, Creation of Legaeldan. '
Ok.

<30000hp 30000m 30000mv>[0Gold][RVnum 706]

Aster's Assistant says ' Do you wish to converse with the almighty creator of th
e realm? '
Bug: [*****] BUG: Mob #701: Found else in an else section.
       
Post is unread #2 Feb 23, 2010, 9:13 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005


3>all_greet_prog 100
if ispc($n)
if isimmort($n)
if name($n) == Aster
Say Greetings Aster, Creator of the Omniverse
else
say Greetings Immortal. How fare thee on this fine day?
endif
else
if sex($n) == 0
say Greetings, Creation of Legaeldan.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
else
if sex($n) == 1
Say Greetings Son of Aster.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
else
if sex($n) == 2
say Greetings Daughter of Silvanyis.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
endif
endif
else
say Greeting creature of the realm.
endif
endif
endif

It doesn't like all those else being used in there. You can probably get it all done without having all the else in there and just use the if checks. I don't have time currently to test it out though, but try it a few different ways and let me know how it goes for you.
       
Post is unread #3 Feb 23, 2010, 11:35 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

When I read that prog, I'm not sure what to make of it.

Is it only supposed to trigger on Immortals? and then mortals all get called creatures of the realm? Or is there maybe an endif out of place?
       
Post is unread #4 Feb 23, 2010, 1:24 pm
Go to the top of the page
Go to the bottom of the page

Legaeldan
Fledgling
GroupMembers
Posts10
JoinedMay 18, 2009

It works, essentially. It's just giving me that bug error once it's said the sentence about conversing.

The way it works is, it responds to immortals with a normal greeting without the question.
Then if the player is not an immortal, it greets them depending on sex, followed by the question about conversing.

So if a girl walks in, it greets a daughter or silvanyis, a boy, it greets a son of aster, and a nuetral, a creation of legaeldan.

It works fine on immortals. But when it gets to the section about mortals and their sex, when it comes to the end of the section of code, it bugs. And it's the same for all sexes, not just one or two.
       
Post is unread #5 Feb 23, 2010, 1:29 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Just use breaks.

if isnpc($n)
say Greeting creature of the realm.
break
endif
if isimmort($n)
...

etc
       
Post is unread #6 Feb 24, 2010, 1:46 am
Go to the top of the page
Go to the bottom of the page

Legaeldan
Fledgling
GroupMembers
Posts10
JoinedMay 18, 2009

Thanks for all the help you guys. I had a play with things, and changed the way the program asked the if checks.
Finally works the way I need it to.

Here's what I went with:

if name($n) == Aster
say Greetings Aster, Creator of the Omniverse.
else
if isimmort($n)
say Greetings Immortal ruler of the land.
else
if sex($n) == 0
say Greetings, Creation of Legaeldan.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
else
if sex($n) == 1
Say Greetings, Son of Aster.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
else
if sex($n) == 2
say Greetings, Daughter of Silvanyis.
mpsleep 4
say Do you wish to converse with the almighty creator of the realm?
endif

Thanks for the help :biggrin:
       
Post is unread #7 Feb 24, 2010, 3:35 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Glad you got it working.

I personally probably would have gone a route like:

if name($n) == Aster
   say Greetings Aster, Creator of the Omniverse.
else
if isimmort($n)
   say Greetings Immortal ruler of the land.
else
if ispc($n)
   if sex($n) == 0
      say Greetings, Creation of Legaeldan.
      mpsleep 4
      say Do you wish to converse with the almighty creator of the realm?
   else
   if sex($n) == 1
      Say Greetings, Son of Aster.
      mpsleep 4
      say Do you wish to converse with the almighty creator of the realm?
   else
   if sex($n) == 2
      say Greetings, Daughter of Silvanyis.
      mpsleep 4
      say Do you wish to converse with the almighty creator of the realm?
   endif
else
if isnpc($n)
   say Greetings, Creature of the realm.
endif


Although, as a further stipulation, I'm pretty sure I've implemented elseif as an argument for my progs locally, so my actually prog probably wouldn't look exactly like this. But still.
       
Pages:<< prev 1 next >>