Login
User Name:

Password:



Register

Forgot your password?
 I3 and IMC
Dec 26, 2024 3:27 am
By GatewaySysop
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
LOP 1.6
Author: Remcon
Submitted by: Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
Users Online
Bing

Members: 0
Guests: 46
Stats
Files
Topics
Posts
Members
Newest Member
496
3,808
19,708
594
MaisieMacl

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » 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 6:50 am   
Go to the top of the page
Go to the bottom of the page

Legaeldan

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 11:13 am   
Go to the top of the page
Go to the bottom of the page

Remcon

GroupAdministrators
Posts1,946
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 1:35 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
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 3:24 pm   
Go to the top of the page
Go to the bottom of the page

Legaeldan

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 3:29 pm   
Go to the top of the page
Go to the bottom of the page

Zeno

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 3:46 am   
Go to the top of the page
Go to the bottom of the page

Legaeldan

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 5:35 am   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
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 >>