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
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Mon Feb 21, 2022 12:02 am   

issue with stringlist and %pop
 
I know using ".(unlock door;open door)n" works no problem... however this is for a script to loop through an area killing mobs til the end then retracing path back to area entrance (and I Do Not use the mapper, this mud has proven difficult to use it with any accuracy... at least for me.) It's just easier for me to map the path I wish to take and use it in a stringlist to then %pop. Using a "Obvious exits" trig to enable another trigger to add mobs to a @klist... then my ktrig or the previous 'Obvious exits" will #IF (%numitems(@klist) > 0) {%pop(areaPath)}

the Issue I am having is there are 4 steps to access the full zone for maximum exp gains...
step_one : search shelves;get gloves
step_two: get key;drop gloves
step_three: unlock door;open door;drop key;w;get key
step_four: unlock door;open door;drop key

these steps are not possible to do while in combat so I have them in the areaPath and I have tried to use (), <>, {}, #exec step (they are aliases but I also tried as full commands

Code:
n|e|w|w|n|nw|e|e|s|n|w|w|n|e|e|n|e|n|s|w|s|e|e|w|s|s|.(search shelves;get gloves)n|n|w|w|w|s|.(get key;drop gloves)n|e|e|e|s|s|e|e|e|n|n|n|n|e|e|s|s|w|w|s|e|e|e|n|n|n|n|w|w|w|w|s|s|s|s|.(unlock door;open door;drop key)w(get key)|e|n|n|n|n|e|e|e|e|s|s|s|s|w|w|w|s|w|w|w|n|n|w|w|n|unlock door;open door;drop key;w|w|s|s|sw|w|w|w|n|nw|e|n|e|e|nw|w|ne|w|e|se|se|ne|e|e|e|w|w|w|sw|s|w|w|w|w|se|e|e|e|s|ne|n|n|e|e|s|s|w|se|s|e|s|s


the issue that I am experiencing is as soon as it hits a <space> the %pop() fails. I'm just lost for a solution

*the aliases work as writen, to 'kickstart' the areaPath when it messes up.
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Mon Feb 21, 2022 6:13 am   
 
You can get combat at ANY point of the above path?

If so then you are testing for NO combat at every step. Obviously an onEnter room event. Wait for a suitable time then test for ongoing combat before stepping on.

However (Shalimar may know more) if you are not using the mapper then I doubt an onEnter event is ever going to fire? Unless you get some feedback from the MUD how on earth do you know if you have actually moved from one room to another, mapper or not?

I doubt any Mudder on any mud advocates no map at all. My map has 35000 rooms and none of them have a description. Just cannot get a satisfactory config for name, desc and exits. But at least I have a working map.

By the way, for testing, try changing the %pop(areaPath) to something that will print out the %pop item. #SH %pop(areaPath) then you can see exactly what is being captured in each %pop
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Mon Feb 21, 2022 6:52 am   
 
ok I figured I failed to fully explain how my uhm 'bot' functions and I'm far from a programmer/coder so I could and most likely am going about this completely wrong.

So I have a DBVar with a master list of all areas I will step/loop, an alias that will then turn on a set group of triggers and 'copy' from the master list to a temp var aka @areaPath stringlist for room movement. BotTrig, autoKill and a 3rd trig (based on the area to turn all triggers for botting off, and clears the temp areaPath of any residual rooms via %null)

BotTrig
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="BotTrig" priority="2080" enabled="false" copy="yes">
    <pattern>^%sThere {is|are} %w obvious exit{s|}:%s*</pattern>
    <value>#IF (@charData.botName != Zelligars) {#T+ autokill} {#T+ agrokill}
#WA 500
#IF (%numitems(@klist) > 0) {
  k %pop(klist)
  #T- autokill
  #T- agrokill
  } {
  #WA 1500
  %pop(botLoop)
  #T- autokill
  #T- agrokill
  }</value>
  </trigger>
</cmud>


autoKill
Code:
<trigger name="autokill" priority="300" regex="true" enabled="false" id="62">
  <pattern>^.*M:(?:\a+ )?\a+ (\a+)</pattern>
  <value>$Monster=%lower(%1)
 
#SW ($Monster)
  ("horseman") {klist = %additem($Monster,@klist);klist = %additem(horse,@klist)}
  ("priest") {klist = %additem($Monster,@klist);klist = %additem(elephant,@klist)}
  ("wandering") {klist = %null}
  ("serial") {klist = %null}
  {klist = %additem($Monster,@klist)}</value>
</trigger>


killTrig (contains this section to be explain further below)
Code:
#WA 1000
#IF (%numitems(@klist) > 0) {
  k %pop(klist)
  #T- autokill
  } {
  #WA 1500
  %pop(botLoop)
  #T- autokill
  }


So how this works is upon room entrance the line "There {is|are} # of obvious exit{s|): blah, blah, blah" will turn on autokill trig to populate my @klist, which then after a 500ms to 2000ms will then check if @klist has any items and either kill the first of if multiple targets, else %pop(areaPath) to move to next room and cycle the check all over again. Should there be a target to kill then the BotTrig only fired off the first half ToKill of the If and does not move... which is where the killTrig section kicks in and either continues to kill if %numitems() > 0 else %pop(areaPath) rinse repeat. I have the 1-2 HB delay just to account for potential server latency or what have you. I don't leave this running unattended, I tend to read manga or have youtube up on a 2nd monitor while this is running so I can react to any oddities.

As for testing for what's happening with the main sample in OP it gets to the ".(search shelves;get gloves)n" and It will send the command ... been a day or more so here are some samples of what it's doing.

Code:
search shelves;get gloves;n
You find nothing of interest.
//-- input of "step_one" alias to force progression --//
> search shelves
get gloves
n
You sweep your hand over one of the higher shelves and
you knock an interesting pair of gloves onto the floor.

During your search of the shelves, you notice a loose looking peg on
the eastern wall.  Removing the peg, a section of wall falls away
revealing a small passage just barely large enough to fit a person.
> gloves: Taken.


before using "step_two" to progress...
Code:
> get key;drop gloves;n
There is no key;drop gloves;n here.
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Wed Feb 23, 2022 5:38 am   
 
After digging around and sleeping on this for a few days... I think I solved the issue.

trying to expand or force #exec from the string list with %pop() is still sending the commands to the mud and not parsing them through cmud.

so I edited the %pop(botLoop) to be #EXEC {%pop(botLoop)} this way if it's an alias or just a string of commands in a single field of the string list it should get parsed through cmud.

I hope...

edit ** This was the ticket to get it working... *facepalm*
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