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
Nyojin
Beginner


Joined: 05 Nov 2005
Posts: 18

PostPosted: Wed Jun 21, 2006 5:00 pm   

Can this be improved?
 
I was given a script by a friend. It is made to input combo's from two variables stored. It has an option to input one, two, and three characters. The script seems to run...shoddy for lack of better word. Its slow, and I don't think its working right. I would appreciate it if anyone could take a look at it and give their input. Thank you very much! Smile

Code:
#CLASS {Weaving}
#ALIAS weave_3 {
; Parses all the weaves possible (3/1)
; Uses timed waits to not fill up the queue
  #FORALL {@runes} {
    #VARIABLE firstL @runes
    #DELITEM firstL {%i}
    #FORALL (@firstL) {
      #VARIABLE secondL @firstL
      #DELITEM secondL {%j}
      #FORALL (@secondL) {
        #FORALL {@shapes} {
          #ECHO Weaving %i %j %k %l
          weave %i %j %k %l
          #WAIT 1750
          }
        #ECHO Waiting 1 second...
        #WAIT 1000
        }
      }
    }
  #ECHO Done!
  }
#ALIAS weave_2 {
; Parses all the weaves possible (2/1)
; Uses timed waits to not fill up the queue
  #FORALL {@runes} {
    #VARIABLE firstL @runes
    #DELITEM firstL {%i}
    #FORALL (@firstL) {
      #FORALL {@shapes} {
        #ECHO Weaving %i %j %k
        weave %i %j %k
        #WAIT 1750
        }
      #ECHO Waiting 1 second...
      #WAIT 1000
      }
    }
  #ECHO Done!
  }
#ALIAS weave_1 {
; Parses all the weaves possible (1/1)
; Uses timed waits to not fill up the queue
  #FORALL {@runes} {
    #FORALL {@shapes} {
      #ECHO Weaving %i %j
      weave %i %j
      #WAIT 1750
      }
    #ECHO Waiting 1 second...
    #WAIT 1000
    }
  #ECHO Done!
  }
#ALIAS weave_all {
  weave_1
  weave_2
  weave_3
  }
#VAR runes {pain|vigor|fire|aegis|dexterity|etude|sleep|blood|disruption|fear|vibration|strength|agility|calm|sonic|bind|esp|movement|enchant}
#VAR shapes {blast|chant|ring|song}
#CLASS 0
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Jun 21, 2006 8:16 pm   
 
A. I see no reason for the #WAIT command in this script, which I agree would really slow it all down.
B. If your lists of runes and shapes are static (i.e., not changing depending on aspects of the game or your character), I recommend you pre-compute the weaves and store the results in variables for future reference. Only run aliases to compute the possible weaves when/if they change.
Reply with quote
Nyojin
Beginner


Joined: 05 Nov 2005
Posts: 18

PostPosted: Wed Jun 21, 2006 11:11 pm   
 
A) The game implements a one second delay upon entering the 'weave' command. What other function could I use? I was thinking #cond or #temp but I am told #temp is unreliable and I can not find a way to make the #cond work with this.
B) I honestly am not sure what you said. The runes and shapes are pretty much the same for your character. Its not common for me to have more then two characters so I figured this method was decent since I can change the variables manually.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jun 22, 2006 5:26 am   
 
#alarm works. #ALARM *delay {stuff to do}. If you want a temporary alarm, use + instead of *.

A wait-state trigger should also do the trick.
_________________
EDIT: I didn't like my old signature
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Thu Jun 22, 2006 6:23 am   
 
This has a LOT of possible weave results if I am reading it correctly:
Code:
19 (runes) * 4 (shapes)                           =      76
19 (runes) * 18 (runes) * 4 (shapes)              =   1,368
19 (runes) * 18 (runes) * 18 (runes) * 4 (shapes) =  24,624

GRAND TOTAL    26,068 combinations

No wonder it is slow!

Is this really what the script is supposed to achieve?
Reply with quote
Nyojin
Beginner


Joined: 05 Nov 2005
Posts: 18

PostPosted: Thu Jun 22, 2006 2:34 pm   
 
Ceres wrote:
This has a LOT of possible weave results if I am reading it correctly:
Code:
19 (runes) * 4 (shapes)                           =      76
19 (runes) * 18 (runes) * 4 (shapes)              =   1,368
19 (runes) * 18 (runes) * 18 (runes) * 4 (shapes) =  24,624

GRAND TOTAL    26,068 combinations

No wonder it is slow!

Is this really what the script is supposed to achieve?


You know...I never really looked at it that way. Boy do I feel sheepish. Embarassed
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