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
mguasch01
Newbie


Joined: 27 Mar 2015
Posts: 2
Location: Austria

PostPosted: Fri Mar 27, 2015 11:39 pm   

Learning to script. Basic questions
 
Hello everyone,

So I'm trying to learn the basics of scripting. Let me first paint you a picture of where I play and what I want to do.

I play an LP MUD, and I want to go through a certain area gathering herbs.
The command to gather herbs is "search here for herbs". It takes a few seconds, then it finds one, and you'd have
to repeat it until there are no more herbs in the room. The command received would be "You find no herbs". I'd like
to search through this area for herbs, moving from room to room until no more herbs are found. I have the area
mapped, and my current sloppy solution is to set a #wa for the amount of miliseconds it takes me to find three herbs,
then move to the next room. The solution isn't optimal because sometimes you find one herb, sometimes three, and
sometimes none. So in the end I either miss a herb or just idle there until the waiting period is over before moving to
another room.

Is there a way to script this task to make it more efficient? What do I need to learn in order to write a working script?

I don't have much experience with CMUD besides basic triggering and aliases, but I understand programming a bit.

Can someone point me in the right direction?

Thanks in advance
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Mar 28, 2015 12:06 am   
 
The #PAUSE and #STEP commands are meant to do just that sort of thing when using speedwalks or paths.
Make use of '#EVENT onRoomEnter' and check it against %zonename or %roomname as to when you need to do it.

Using #HELP on most #COMMANDs and %functions will pull up the cmud help files.

Any other questions feel free to ask for clarification.
_________________
Discord: Shalimarwildcat
Reply with quote
mguasch01
Newbie


Joined: 27 Mar 2015
Posts: 2
Location: Austria

PostPosted: Sat Mar 28, 2015 12:40 am   
 
Shalimar, thanks for your prompt reply.

I've looked into the help files on those commands and tried it out but it's not working for me. Let me see if I understood it correctly.

I'd have to slowwalk somewhere and pause in case of finding something, then renew the slow walk afterwards.

Apparently, the SLOW command awaits from some kind of confirmation?

I'm sorry if I'm totally clueless, but can you give me a "for dummies" version?

What I'd like to do is search in every room, and react to a string from the mud (You find no herbs) by moving forward in the path.

At the moment I'm doing this (short example)

nw;search here for herbs;#wa 5000;
n;search here for herbs;#wa 5000;

with strings like "You find a <herbname>!" triggered to react to "search here for herbs" again.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Mar 28, 2015 9:11 am   
 
Alright for the help files you would do something like:
#HELP #TRIGGER
or
#HELP %numitems
If its not a valid command or function name it will say file not found, or something similar.

You said you already had the area mapped so i assumed you had some basic map triggers already.
If not you may need to set up #TRIGGERS that will #TAG roomdata.
the mapper will need to be reconfigured after there creation, if it hasn't been already.

I find the map works best in Safe mode when you want to pause things.

Here are some basic settings:

#EVENT onRoomEnter {#PAUSE;search here for herbs}
#TRIGGER {You find *!} {search here for herbs}
#TRIGGER {You find no herbs.} {#STEP}

Thats with no error testing as for when it wants it to be done mind you, this should have you attempting to search with every movement.
You could even queue up several movement commands and it would (should) know to stop in each room along the way.
Assuming you have a good map.
_________________
Discord: Shalimarwildcat
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