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


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 12:35 pm   

Need simple variable list for T2T mud working.
 
Hi,i myself can do only aliases,triggers and variables are beyond me.

I made alias named x....kill @enemy.Made variable @enemy,inside string list consisting of rat,dog,mouse,wolf,rabbit ect.When i type x,game only kills target,if it is single string in list,aka in room is dog,and my string list only has dog in it.Asap i put second line rabbit or whatever,return is..i dont see that here...Where i went wrong?Might be some cmud 3.34 variable checkboxes.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Oct 22, 2011 1:18 pm   
 
It's not entirely clear what you're trying to do. Is your list of potential enemies that you want the script to automatically attack any time they're seen, or is it a list of enemies to kill one by one?

If you want it to automatically attack if it sees any of those enemies, you could have this code (you may need to adjust the trigger to match your mud):
Code:
enemy=rat|dog|mouse|wolf|rabbit
#TR {You also see ({@enemy}).} {#SEND kill %1}

If you want to kill everything in the list, you could have this:
Code:
#ALIAS x {#FORALL %1 {#SEND kill %i}}

With this second alias, you would type into the command line
Quote:
> x rabbit|dog|mouse

and CMUD will send
Quote:
kill rabbit
kill dog
kill mouse


If this doesn't answer your question (and I doubt it does, I'm not quite sure what your question is), clarify what you want and we can point you in the right direction.
_________________
.geniusclown
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 2:38 pm   
 
Well...i hunt for gold and exp in areas mostly with different animals.So far i used alias :x.text do kill dog,kill fox,kill newt,kill lizard,kill wolf,kill salamander,kill wolf,kill toad,kill rabbit.For any animal not in room game answer :You don't see that here.
Garbages my window,can i gag that line?

Eventually i liked to have variables list with animals.When i enter room,client sees animal from list and sends kill <animal>.

There isn't i see in t2t mud.This is example of text client shows: This section of tunnel is broad, and the ceiling quite out of
reach. The walls are rough and glisten occasionally when light
reflects off the minerals in the rock of the Blue Mountains. The
ground is uneven and dusty, and myriad footprints of different
origin are testament to frequent traffic.

The only obvious exits are north and south.
A lizard
HP:70 EP:70>

Apparently there is lizard in room.I can manually kill lizard....after several rounds,it fell to floor and starts bleeding.

Here is how it looks in mud :Lizard falls to the ground.
Lizard is bleeding to death and needs to be bandaged!

Can i have trigger for another x alias keypress to game.Mud looks like this:You decide to put Lizard out of its misery.
I do manually usually
kill lizard (it bleeds slowly to death unless 2x killed).
After that i manually use alias z :do skin corpse,attach pelt to string,eat corpse (raw?!yak!).

Can all of it be triggered from @enemy list?All till chewing raw meat?(replenishes HP and EP). Question
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 2:41 pm   
 
it fell to floor and starts bleeding-sounds like good trigger catch phrase.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Oct 22, 2011 4:31 pm   
 
The trickiest part of what you want to do is that the list of critters in the room doesn't have much to match a trigger to, but it looks like the list will always be immediately after the exits line, so we can trigger off that and set a condition to see if the next line has any enemies from your list (type "#HELP multistate trigger" from your command to get details on what this means).
Code:
enemy=lizard|dog|rat|etc
#TR {obvious exits}
#COND {({@enemy})} {#SEND kill %1} {Within|Param=1}

This will only attack one critter. If several critters are listed, it gets more complex. How much more complex depends on how they're listed and what sort of variety it shows. If the list of critters is always just "a dog" or "a lizard" and never "a hell hound" or "an enormous lizard", this would be the easiest case, because you just check the second word using the %word function. If the critters could be listed as "an enormous hell hound with three eyes" then you'd have to check every word, which can be done with a nested loop. Here's the code of the simplest case, where each critter listed is always the article (a, an, the) followed by the critter and the critters are separated with commas:
Code:
#TR {obvious exits}
#COND {^(*{@enemy}*)$} {
  #FORALL %replace(%1,", ",|) {#IF (%ismember(%word(%i,2),@enemy) {#SEND kill %word(%i,2)}}
  } {Within|Param=1}

Here's an example of a nested loop:
Code:
#TR {obvious exits}
#COND {^(*{@enemy}*)$} {
  #FORALL %replace(%1,", ",|) {
    #FORALL %replace(%i," ",|) {#IF %ismember(%j,@enemy) {#SEND kill %j}
    }
  } {Within|Param=1}


As for when the critter is dead:
Code:
#TR {^(*) is bleeding to death and needs to be bandaged!} {kill %1;skin corpse;attach pelt to string;eat corpse}
_________________
.geniusclown
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 5:40 pm   
 
Well,its usually a large bat,a brown bat,a hungry wolf,ect.

Now,bigger problem for me is to get all it into cmud settings right way.I am using cmud 3.34 (has full month trial).Its graphical.Works via tickboxes,usually i dont even knew,what that or other tickbox checked or unchecked do.

i quess i need to make variable @enemy with list of critters first.it has checkboxes:actually scrollbar:AutoType,Integrer,String (expanded),String (literal),String list,database record,array,Flat,COM Object.i QUESS i need to do string list type or....It also has checkboxes case filter (mine is off) and nest sort (mine is on).
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 5:43 pm   
 
Ohh,and can i gag some nasty game lines?
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 6:17 pm   
 
second code error:unmatched parentesis,nested loop error:illegal token
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Oct 22, 2011 6:41 pm   
 
I see the missing brace. Try this:
Code:
#TR {obvious exits}
#COND {^(*{@enemy}*)$} {
  #FORALL %replace(%1,", ",|) {
    #FORALL %replace(%i," ",|) {#IF %ismember(%j,@enemy) {#SEND kill %j}}
    }
  } {Within|Param=1}

Most of the tickmarks in the Package Editor are best on default. For example, "AutoType" is always best unless you want to force it to be particular type. All of the options are explained in the help files.

The Documentation is your friend. You can quickly access much of the help documents by typing #HELP into the command line. For example, typing "#HELP #HELP" into the command line will open the Documentation to the page that describes the #HELP command.

To gag lines you don't want to use:
Code:
#TR {^Gag this line.$} {#GAG}

Where the ^ means to match at the beginning of the line and $ means to match at the end of the line.
_________________
.geniusclown
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 7:42 pm   
 
I think,skinning after bleed is not right.Target is not dead yet,and game didnot yet updated text with corpse.Example what happened:

Fat piglet is bleeding to death and needs to be bandaged!
kill Fat piglet
skin corpse
attach pelt to string
eat corpse
You decide to put Fat piglet out of its misery.
HP:76 EP:80>
You can't see any corpse to skin.
HP:76 EP:80>
Attach what to string?
HP:76 EP:80>
There is no corpse here.
HP:76 EP:80>
You killed Fat piglet.
Fat piglet has died.
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 8:11 pm   
 
Remade bleeding trigger to :<trigger priority="230" id="23">
<pattern>^(*) is bleeding to death and needs to be bandaged!</pattern>
<value>kill %1</value>
</trigger>
Remade on basis of bleeding trigger:#TR {^(*) has died} {skin corpse;attach pelt to string;eat corpse}.

Will see.


Yes,those 2 work like charm.
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 8:21 pm   
 
btw,always one critter per room,fat piglet,brown bat ect
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Oct 22, 2011 8:38 pm   
 
If it's working as is, great! If it's always just one critter, then the loops aren't necessary. Stick with
Code:
#TR {obvious exits}
#COND {({@enemy})} {#SEND kill %1} {Within|Param=1}


You're adjusting the code for your game now. That's what you'll need to do. Now go study the help docs and code, code, code!
_________________
.geniusclown
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 9:05 pm   
 
How to gag 2 lines?

Yada yada yada!
HP:80 EP:80>

i might need hp-ep for score or something,but not spammed like it now is 25 times in a row
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sat Oct 22, 2011 9:22 pm   
 
Kill trigger does not trigger
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sun Oct 23, 2011 8:52 am   
 
Well,i knew now how to gag one line,but how to gag 2 lines,what are always after each other,and also do not allow empty line spaces where gagged lines where?As i have like 30 lines enemy variable list,each critter does 2 lines of text,one for false return and my hp-ep values.In short full screen of useless info.

Entering room auto kill against enemy list doesnot work.Today i try both brief and verbose mode,to look,if there is difference.

BTW,i think both bleed or dead trigger,what i got work,i can remodel also for :do get all from corpse,put all into pack command (humanoid targets).
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sun Oct 23, 2011 9:12 am   Now i found this...
 
Code:
;Trigger for looting corpse and resuming walking.

 #TRIGGER {^corpse *.} {skin corpse,attach pelt to string,eat corpse;#T+ akill;#T+ walk;look;#ALARM +2 {#RESUME a1}}

 ;Class that contains triggers for attacking mobs and temporarily stopping movement.
 ;First triggers kills all types of animals, and suspends the alarm for walking. Note that the order of those 4 commands should not matter.

 #CLASS {akill}
 #TRIGGER {a* piglet* } {
   #T- walk
   #SUSPEND a1
   kill piglet 1
   #T- akill
   }
 #TRIGGER {a* chick* } {
   #T- walk
   #SUSPEND a1
   kill chick 1
   #T- akill
   }
 #TRIGGER {a* chicken* } {
   #T- walk
   #SUSPEND a1
   kill chicken 1
   #T- akill
   }
 #TRIGGER {a* deer* } {
   #T- walk
   #SUSPEND a1
   kill deer
 1
   #T- akill
   }
 #TRIGGER {a* bear* } {
   #T- walk
   #SUSPEND a1
   kill bear 1
   #T- akill
   }
 #CLASS 0

 ;This is what keeps it moving. The alarm will be suspended if there are any matching mobs in the room, and it will resume once all matching mobs have been killed.

 #CLASS {walk}
 #TRIGGER {^The only* obvious exits:*} {
   #ALARM "a1" +2 {
     #STEP
     #PAUSE
     }
   } "" {notrig}
 #CLASS 0


with alias
Code:
x=#SLOW path
 #PAUSE


I remodelled it for my mud room descriptions and animal names
Added,but now i found cleaner trigger
Code:
#TRIGGER {a* ({piglet|deer|bear|chicken|snake|gopher})* standing here} {#T- walk;#SUSPEND a1;kill %1 1;#T- akill}

How i remake big script into cleaner one?BTW this was originally for ZMud,will it work in CMud?
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sun Oct 23, 2011 1:03 pm   
 
You remake a big script into a cleaner one by learning how CMUD functions. The best way to do that is RTFM and PAFO.

Many scripts from zMUD will work with CMUD, though some commands, functions, and syntaxes have changed... "#HELP zmud" from the command line will take you to the spot in the manual that discusses the changes (though if you're just using a few scripts here and there, most won't be relevant to you).
_________________
.geniusclown
Reply with quote
raudkoer
Beginner


Joined: 22 Oct 2011
Posts: 14

PostPosted: Sun Oct 23, 2011 1:17 pm   
 
Still...i have this in game
You don't see that here.
HP:80 EP:80>

How to gag it all without black line spaces left?When hp and ep rises,will change manually.

I understand RTFM,but actually,all scripting/coding is a bit beyond me.Firstly it is in english,secondarily it is math logic.I am what...25 years out of school,don't use any math in life (almost).Strictly saying,memory isn't either,what it used to be...
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