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
Drakmorden
Novice


Joined: 14 Dec 2000
Posts: 34
Location: USA

PostPosted: Mon Nov 04, 2002 11:56 pm   

Stringlist info
 
I had a response from someone a while back, and the post seems to be missing and I have lost the format for the following:

I want to incorporate into my script a string list that will allow step to the next position in the list for direction moves like so -

#var directions {n|e|e|n|e|e}

basically to replace doing the following to step:

#alias a1 {n;kill mob;#var directions a2}
#alias a2 {e;kill mob;#var directions a3}
etc..

I am stepping using various triggers representing when the mob is not there.

I have looked through the help files and cannot seem to figure out a way to step through the list one direction at a time.

Any help would be greatly appreciated.

Thanks,
DrakMorden
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Nov 05, 2002 12:52 am   
 
#VAR nextdir 1
#AL step {%item(@directions, @nextdir);#IF (@nextdir < %numitems(@directions)) {#ADD nextdir 1} {#VAR nextdir 1}}

LightBulb
Senior Member
Reply with quote
Drakmorden
Novice


Joined: 14 Dec 2000
Posts: 34
Location: USA

PostPosted: Wed Nov 06, 2002 1:39 am   
 
ok.. here is what I have put together so far, however I am still looping somewhere even though I only have 3 directions set in the variable list and cannot seem to locate it.


#CLASS {AsylumTriggerSet}
#TRIGGER {Eyeing you suspiciously, this valkyrian ogre confidently stands her ground.} {#class {Asylum2};#var mob1 1;#var mob1a ogre;#t- AsylumTriggerSet}
#TRIGGER {A soldier of the Vl'lak circle wanders about the campground.} {#class {Asylum2};#var mob1 1;#var mob1a ogre;#t- AsylumTriggerSet}
#TRIGGER {soldiers argue amongst themselves} {#class {Asylum2};#var mob1 1;#var mob1a ogre;#t- AsylumTriggerSet}
#class 0
#CLASS {Asylum2}
#ALIAS autoasylum {#class {Asylum2};#var nextdir 1;#class {0};#t+ AsylumTriggerset;look;#t- AsylumTriggerSet;tz}
#ALIAS nok {#t- AsylumTriggerSet;#class {Asylum2};#var mob1 0;#var mob1a 0;#t- Asylum2}
#ALIAS step {#t- AsylumTriggerSet;#class {Asylum2};#var mob1 0;#var mob1a 0;%item( @directions, @nextdir);#IF (@nextdir < %numitems( @directions)) {#ADD nextdir 1} {nok}}
#ALIAS n {north;#t+ AsylumTriggerSet;look;tz}
#ALIAS s {south;#t+ AsylumTriggerSet;look;tz}
#ALIAS e {east;#t+ AsylumTriggerSet;look;tz}
#ALIAS w {west;#t+ AsylumTriggerSet;look;tz}
#ALIAS u {up;#t+ AsylumTriggerSet;look;tz}
#ALIAS d {down;#t+ AsylumTriggerSet;look;tz}
#ALIAS tz {#class {Asylum2};#if (@mob1 = 1) { ttrue} { ffalse}}
#ALIAS ffalse {step}
#ALIAS ttrue {@attack @mob1a}
#VAR mob1 {0}
#VAR nextdir {0}
#VAR mob1a {0}
#VAR target {0}
#VAR attack {mm}
#VAR directions {s|s|s}
#TRIGGER {is DEAD!} {get all, corpse;sac corpse;#class {Asylum2};#var mob1 0;#var mob1a 0;#t+ AsylumTriggerSet;look;#t- AsylumTriggerSet;tz}
#CLASS 0

Can you see where I am hosing it up?

Thanks,
Drakmorden of Nodeka
Reply with quote
Drakmorden
Novice


Joined: 14 Dec 2000
Posts: 34
Location: USA

PostPosted: Wed Nov 06, 2002 3:26 am   
 
Oh, and to add, I tried stepping through the debugger, and once it hits the "is DEAD!" trigger it starts looping and shuts zmud completely down...

Thanks,
Drakmorden of Nodeka
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Nov 06, 2002 5:13 am   
 
You have a lot of #CLASS commands in your #TRIGGERs and #ALIASes, apparently because you want your variables in subclasses. However, you've done a poor job of providing the matching #CLASS 0's to return to the normal default class. What this does is put "Asylum2" as your default class when either of the triggers in "AsylumTriggerSet" goes off, and sets the variable @mob1 to 1 IN ASYLUM2. There's only one trigger in "Asylum2", and it changes the default class to "Asylum2|Asylum2", then sets the variable @mob1 to 0 IN ASYLUM2|ASYLUM2, leaving the variable @mob1 set to 1 IN ASYLUM2.

If you must put your variables into subclasses (I don't see any reason to), use the Class field in the #VAR command (#VAR mob1 1 _nodef Asylum2).

#CLASS {AsylumTriggerSet}
#TRIGGER {Eyeing you suspiciously, this valkyrian ogre confidently stands her ground.} {#class {Asylum2};#var mob1 1;#var mob1a ogre;#t- AsylumTriggerSet}
#TRIGGER {A soldier of the Vl'lak circle wanders about the campground.} {#class {Asylum2};#var mob1 1;#var mob1a ogre;#t- AsylumTriggerSet}
#TRIGGER {soldiers argue amongst themselves} {#class {Asylum2};#var mob1 1;#var mob1a ogre;#t- AsylumTriggerSet}
#class 0
#CLASS {Asylum2}
#ALIAS autoasylum {#class {Asylum2};#var nextdir 1;#class {0};#t+ AsylumTriggerset;look;#t- AsylumTriggerSet;tz}
#ALIAS nok {#t- AsylumTriggerSet;#class {Asylum2};#var mob1 0;#var mob1a 0;#t- Asylum2}
#ALIAS step {#t- AsylumTriggerSet;#class {Asylum2};#var mob1 0;#var mob1a 0;%item( @directions, @nextdir);#IF (@nextdir < %numitems( @directions)) {#ADD nextdir 1} {nok}}
#ALIAS n {north;#t+ AsylumTriggerSet;look;tz}
#ALIAS s {south;#t+ AsylumTriggerSet;look;tz}
#ALIAS e {east;#t+ AsylumTriggerSet;look;tz}
#ALIAS w {west;#t+ AsylumTriggerSet;look;tz}
#ALIAS u {up;#t+ AsylumTriggerSet;look;tz}
#ALIAS d {down;#t+ AsylumTriggerSet;look;tz}
#ALIAS tz {#class {Asylum2};#if (@mob1 = 1) { ttrue} { ffalse}}
#ALIAS ffalse {step}
#ALIAS ttrue {@attack @mob1a}
#VAR mob1 {0}
#VAR nextdir {0}
#VAR mob1a {0}
#VAR target {0}
#VAR attack {mm}
#VAR directions {s|s|s}

#TRIGGER {is DEAD!} {get all, corpse;sac corpse;#class {Asylum2};#var mob1 0;#var mob1a 0;#t+ AsylumTriggerSet;look;#t- AsylumTriggerSet;tz}
#CLASS 0
#VAR mob1 {0}
#VAR nextdir {0}
#VAR mob1a {0}
#VAR target {0}
#VAR attack {mm}
#VAR directions {s|s|s}


LightBulb
Senior Member
Reply with quote
Drakmorden
Novice


Joined: 14 Dec 2000
Posts: 34
Location: USA

PostPosted: Wed Nov 06, 2002 12:57 pm   
 
I had to put all of those class declarations in there because my zmud has recently started creating variables all over the place haphazardly in my directory. One time it will start creating them in one folder, and another the next, and sometimes it creates hundreds of the same variable in the same folder. This is the only way I have found to get it to stop doing that.

Thanks though, I will try it.

Drakmorden
Reply with quote
Drakmorden
Novice


Joined: 14 Dec 2000
Posts: 34
Location: USA

PostPosted: Wed Nov 06, 2002 1:06 pm   
 
Nope, still completely crashes just like it was, and I have variables in other folders. Every time it tries to create/modify a variable, it creates it somewhere unwanted or duplicates it. (Which is why I am trying to change my scripting logic to this style idea.) Since my current scripts have anywhere from 300-600 lines each that do this type of thing: #alias a1 {n;kill mob;#var directions a2} create 600 different variables randomly throughout my directory. So, my @directions variable gets created many different places, thusly when it goes to call the @directions variable for the next step, it is also randomly reading one of the created variables and it usually is a previous step in the script rather than the next one like I need it to be.

So, basically I am "over"-classing my script out of necessity.

Drakmorden
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