|
kazu Beginner
Joined: 16 Sep 2008 Posts: 17
|
Posted: Sat Feb 14, 2009 7:43 pm
Stringlists |
Ok, I play Achaea, and I'm trying to develop my own curing system. I have it set up so that whenver I get afflicted with something, it adds it to one of 3 stringlists depending on the type of cure. I then have a priority stringlist for the order I want them to be cured. However, I'm stuck at this point. How do I get the system to run through the priority one when curing the other?
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 14, 2009 8:59 pm |
Use the #PRIORITY command! :ba-da-bing!:
Actually, use the priority stringlist to #forall through possible afflictions. Within that forall loop, you will then check to see if %i is a member of your afflictions stringlist. If not, then you just go on to the next item in the priority list; if so, you would then check to see if you had the cure, curing/not curing as needed.
At the end, after you exit the priority loop, you would then check to see if you still had any afflictions. If you do, might want to run the cures alias again. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
kazu Beginner
Joined: 16 Sep 2008 Posts: 17
|
Posted: Sun Feb 15, 2009 1:56 am |
#FORALL @phafflicted {#if (%ismember( %i, @current_afflictions))} {cure alias}
Like that
? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Feb 15, 2009 2:35 am |
Bear in mind that that's a pretty slow way of going about this problem, though - %ismember has to traverse through the whole stringlist looking for the item, so each time you run your #forall loop with 20ish members in @phafflicted, you'll be traversing @current_afflictions 20ish times, which can take long time if the list is long and the item you're after is near the end. If you're strongly attached to using a table for your afflictions' priorities (if, for example, you like to change it often) then you can keep that part, but tracking which afflictions you have is probably better accomplished with a table of afflictions where keys are affliction names and the value is true. Then you can do #if (%db(@current_afflictions,%i)) {cure alias}, which is hopefully faster. I think it'll depend on the length of the @current_afflictions list, though, so it might bear some more thorough testing.
Another important thing will be to abort the loop once it's found something to cure, because continuing past that point is a waste of time. I think in zMUD you need to use the #abort command rather than CMUD's new #break. |
|
|
|
kazu Beginner
Joined: 16 Sep 2008 Posts: 17
|
Posted: Sun Feb 15, 2009 2:48 am |
My problem is that I'm lousy at coding. I heard that this was a simple way that would still be fairly fast. I also heard that zmud didn't handle databases too well. I'm open for advice though, it will have to be in really simple terms with lots of examples though.
|
|
|
|
Leitia Adept
Joined: 04 May 2007 Posts: 292 Location: Boston
|
Posted: Mon Feb 16, 2009 4:13 pm |
When I played Achaea I use ACP_LE, that is in the scripts section here. It was dated when I used it, but that system taught me about database variables and stringlists. It is a morass of code and difficult to learn by, but whenever I had a question I could check to see if, and how then, it was done. Some peculiar Achaean things are there too used as methods of timing and, like in the case of druidic morphing, entirely new handlers of what can't otherwise be done. I used the morph trigger, an expression, for other things but never really used the curing system much for arena combat.
Anyway, if you can't write code well you will need to learn it well as Achaea throws radicals at your system and is principled (in theory) on not coding it. |
|
|
|
|
|
|
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
|
|