Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Zoticus
Beginner


Joined: 16 Jan 2010
Posts: 24

PostPosted: Mon Oct 22, 2012 6:21 pm   

Queue?
 
Hello -

I have a bit of a general question, and I'd like input. I'm at a snag in my system, and I want to know how to get past it.

In my mud, you can be afflicted with various maladies. When you're afflicted, you can cure it - sometimes in more than one way.

My issue is this:

Each aff is run through a 'scan' that tells my system what type of affliction it is - then, that curative type is executed. However, right now, my system executes -any- available cure for a given affliction, rather than just the first available one.

This results in attempting to cure a single affliction with maybe three different abilities - when only the first has any effect, obviously.

How do I tell my system to.. pick one, and if it's unavailable, use the next?

Edit - Also, if anyone has AIM and wouldn't mind me adding them for little questions like this, please, let me know. I know it's something simple that I've missed, and it usually is. Earlier, it was sending the cure command for a given curative method once for each affliction in that scan. I fixed that - it was an extra parenthesis.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Mon Oct 22, 2012 6:30 pm   
 
well you could copy all of the abilities into a temporary variable and %pop them off as you get fail messages

Assuming you have a database of all the various afflictions and thier cures, it would be something like

#TR {how you know you are affected} {
thisCure=@affliction.malady
#SEND %pop(thisCure)
}

#TR {{@cureFailures}} {#IF (@thisCure) {#SEND %pop(thisCure)} {#SAY known cures exhausted}}
_________________
Discord: Shalimarwildcat
Reply with quote
Zoticus
Beginner


Joined: 16 Jan 2010
Posts: 24

PostPosted: Mon Oct 22, 2012 6:36 pm   
 
Unfortunately for that method, there's not really any 'one' message for a cure failure - there's many, and a lot of them are things that don't always mean failure in and of themselves.

I do have a database of the affs and their cures - it's actually used as a priority database, to determine which afflictions should be cured first.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Mon Oct 22, 2012 6:39 pm   
 
right, which is why i used a variable placeholder for the failures
put all the messages into that variable, and it will still fire
and it does test to see if you have any cures lined up before issuing commands...

feel free to message me about this
_________________
Discord: Shalimarwildcat
Reply with quote
Zoticus
Beginner


Joined: 16 Jan 2010
Posts: 24

PostPosted: Mon Oct 22, 2012 7:32 pm   
 
Does anyone have any other suggestions I could consider while I gather the myriad of lines Shalimar's suggestion will require?

Currently, my system works like this:

Gain affliction -> Add affliction to variable and check affliction against a typing variable. Add 'scan' for that type to the queue -> the prompt comes, and the scan is run -> the aliases to execute the cure methods fire.

Except, since the affliction matches the value of more than one typing variable, it sends all the cure methods that match.
Reply with quote
Amorelia
Beginner


Joined: 09 Oct 2012
Posts: 18

PostPosted: Mon Oct 22, 2012 10:09 pm   
 
Depends on the volume of data. If a few items, you could use boolean variables. For more, some sort of #CASE or #SWITCH functions. For a lot, parse a database or text file (although this could get slow).
Reply with quote
Zoticus
Beginner


Joined: 16 Jan 2010
Posts: 24

PostPosted: Mon Oct 22, 2012 10:49 pm   
 
I fixed the issue. I added in a flag - if I'm doing one cure, don't do another. I was relying entirely on the ability to actually do it - the 'balance' as it were, required to execute a cure method. I wasn't actually tracking the fact that I had attempted to do it.

This resulted in my system trying to do something as many times as the number of afflictions required, by as many methods as possible, since it hadn't been told that it'd already tried to fix the problem.

A simple '!%ismember( curing, @MyFlags)' with 'curing' replaced with the specific method of cure was enough.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net