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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Tommy2143
Beginner


Joined: 10 Aug 2002
Posts: 17

PostPosted: Mon Feb 24, 2003 4:39 pm   

Perplexed
 
Ok so I've got this autoattacking script for MajorMUD, and I'm trying to now make a different script to use slowwalking paths to loop with. However, the trigger I use to indicate I've moved a room seems to interfere with my autoattack in some way, because it keeps trying to attack non-hostiles that arent in my enemylist. Here's the main parts that seem to be conflicting, if I miss some trigger or information that someone thinks they need to see, let me know.

Here goes,
#TRIGGER {^Also here~: (*)} {#if (@combat == 1) {#abort 1};#if (@protect == 1) {#abort 1};#if (@autocombat == 0) {#abort 1};#var roomlist "%1";#if (%ends( @roomlist, ".") == 0) {#t+ Autoattack2} {sortlist;#t- Autoattack;#wait 1000;#t+ Autoattack}} "Autoattack"
#TRIGGER {^(*)$} {#if (@combat == 1) {#abort 1};#if (@autocombat == 0) {#abort 1};#if (%pos( "Obvious exits: ", %1) != 0) {#t- Autoattack2;#abort 1};#var roomlist %concat( @roomlist, " ", "%1");#if (%ends( @roomlist, ".") != 0) {sortlist;#t- Autoattack2}} "Autoattack2"
#ALIAS sortlist {#var roomlist %remove( "Also here: ", @roomlist);#var roomlist %remove( ".", @roomlist);#var roomlist %remove( "small ", @roomlist);#var roomlist %remove( "big ", @roomlist);#var roomlist %remove( "fierce ", @roomlist);#var roomlist %remove( "happy ", @roomlist);#var roomlist %remove( "fat ", @roomlist);#var roomlist %remove( "nasty ", @roomlist);#var roomlist %remove( "thin ", @roomlist);#var roomlist %remove( "angry ", @roomlist);#var roomlist %remove( "large ", @roomlist);#var roomlist %remove( "short ", @roomlist);#var roomlist %remove( "tall ", @roomlist);#var roomlist %replace( @roomlist, "*", "");#var roomlist %replace( @roomlist, ", ", "|");#var roomlist %replace( @roomlist, " |", "|");#var roomlist %trim( @roomlist);#if (%pos( "|", @roomlist) == 0) {#if (%ismember( @roomlist, @enemylist)) {#if (@combat == 0) {attack @roomlist}};#abort 1};#forall @roomlist {#if (%ismember( %i, @enemylist) == 0) {#var roomlist %delitem( %i, @roomlist)}};#if (@roomlist != "") {#if (@combat == 0) {#var roomclear 0;attack %item( @roomlist, 1)}} {#var roomclear 1}}


That is all the autoattack stuff, and it has a button to enable/disable it. Also the @protect thing is a button used to attack whatever another player attacks, if enabled. That overrides the autoattack trigger. The trigger causing the interference is this one:


#TRIGGER {^Obvious exits~: (*)} {#wait 500;#if (@roomclear == 0) {#abort 1};#if (@combat == 1) {#abort 1};#if (@waiting == 1) {#abort 1};#if (@resting == 1) {#abort 1};#ok} "Script"

This is merely supposed to determine if the script can move forward, but for some reason whenever it's turned on, the autoattack tries to attack non-hostiles that arent in the enemylist, something that it doesnt do any other time except when this trigger is enabled.

I know this prolly looks pretty shoddy, and I'm sure it could prolly be coded tighter, but I'm still learning ZMud really, so any help would be greatly appreciated. If I just confused the crap out of everyone, let me know. Thanks in advance.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Feb 24, 2003 11:04 pm   
 
You know, it is too bad the server I used to play MajorMud on went down. When that happened I threw away all my scripts for MajorMud.
The primary cause of trouble with your scripts is the use of the #WAIT command. The second cause of trouble is flow control. By flow control I mean how your scripts are turned on and off, and which triggers activate which portions. Because the exit line will always be shown with each room, you should put attack processing on that trigger. Don't bother checking @autocombat, @combat, and @protect during the capture of monsters. Instead check them only once in the exit line trigger and if all conditions are met then sort list there. The first 2 commands in the exit line trigger should be #OK;#STOP, once all checking to determine if combat or other states require you to stay stopped is done issue #STEP, or if not moving turn on an #ALARM set to activate every 5 seconds with a command of #CR (I assume you have prompt set to full or full custom). I can keep going telling how to best script that mud for hours, but I will let you figure it out.
Reply with quote
Tommy2143
Beginner


Joined: 10 Aug 2002
Posts: 17

PostPosted: Tue Feb 25, 2003 6:19 am   
 
Well, the reason I did the @combat checks and such is that is seems like a waste of processing to do all that list sorting if combat is already engaged. As for the #wait in the exit line trigger, it's to ensure that the other triggers get done all their processing, because I had trouble at first with it doing stuff before the other triggers were done.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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