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


Joined: 19 Aug 2002
Posts: 11
Location: Canada

PostPosted: Sat Jun 28, 2003 2:13 am   

information on possible variables/methods to use
 


Hi, I'm building a mining script for a (sort of) smaug based mud. Mostly, I'm just looking for possible variables, and ideas to use to accomplish what i desire.

- I would like to enter the 'mine', and then pick a direction, such as 'mine down' and then have all my triggers change to accomodate the direction i have chosen.
(i have north, south, east, west, up, and down directions to choose from)

For now, it works in a basic fashion, my triggers function, but, when i want to change direction, i need to manually edit each trigger to mine in the new specified direction. It's my desire to simply mine north, and i continue mining north, until i mine down, at which time my triggers change, and i begin mining down. There are many triggers involved, so i'm thinking, make a 'direction variable' ?

Next, there are instances in mining, when several different types of materials are mined up at the same time. When this happens, my triggers go crazy. (mostly because of the 'you stop mining' trigger)
In this instance, i would need the variable to ignore the previous line, which would solve my problem i think. So, 'you dig up mitrill ore and drop it on a stack', followed by another line of 'you dig up copper ore and drop it on a stack', it would ignore previous line of mitrill ore, and continue mining in the specified direction. (or collect the ore, and then mine in the specified direction)

To better help anyone who wants to see whats happening, i've included some sample triggers which i currently use. The instances in my triggers where i have the commands 'inventory' executed, are there because we can only type the same command 20 consecutive times before it kicks me out for spamming, by using 'any command' i can prevent from being kicked. And 'portal' is simply a container which holds mining picks, and ore which i have dug up.

I have come across the 'ignore previous line' somewhere before i think, but i can't seem to locate it now, it might be due to my lack of sleep, hard to say.


//sample triggers

#TRIGGER {You clear a path deeper into the layers of rock.} {say i wish i could move in the direction i had been previously mining} "Mining"
#TRIGGER {Nothing to mine in that direction.} {say ok, end of the line, pick a new direction} "Mining"
#TRIGGER {You stop mining...} {mine down} "Mining" //used for when i need to disrupt mining, such as from casting a spell

#TRIGGER {You didn't find any resources.} {mine down} "Mining"
#TRIGGER {You didn't find any ore.} {inventory;mine down} "Mining"
#TRIGGER {You break a mining pick!} {inventory;mine down} "Mining"
#TRIGGER {You need to have a mining pick in your inventory.} {get pick portal;mine down} "Mining"


#TRIGGER {You dig up Clay (**) and drop it on a stack!} {inventory;mine down} "Mining"
#TRIGGER {You dig up Clay and drop it on a stack!} {inventory;mine down} "Mining"

#TRIGGER {You dig up Limestone and drop it on a stack!} {inventory;mine down} "Mining"
#TRIGGER {You dig up Limestone *** and drop it on a stack!} {inventory;mine down} "Mining"

#TRIGGER {You dig up Shalestone and drop it on a stack!} {inventory;mine down} "Mining"
#TRIGGER {You dig up Shalestone *** and drop it on a stack!} {inventory;mine down} "Mining"

#TRIGGER {You dig up Granite and drop it on a stack!} {inventory;mine down} "Mining"
#TRIGGER {You dig up Granite (**) and drop it on a stack!} {inventory;mine down} "Mining"

#TRIGGER {You dig up Copper ore and drop it on a stack!} {get 'copper ore';put ore portal;mine down} "Mining"
#TRIGGER {You dig up Copper ore (**) and drop it on a stack!} {get 5 'copper ore';put 5 ore portal;mine down} "Mining"

#TRIGGER {You dig up Mitrill ore and drop it on a stack!} {get 'mitrill ore';put ore portal;mine down} "Mining"
#TRIGGER {You dig up Mitrill ore (**) and drop it on a stack!} {get 5 'mitrill ore';put 5 ore portal;mine down} "Mining"
Reply with quote
canute
Beginner


Joined: 19 Aug 2002
Posts: 11
Location: Canada

PostPosted: Sat Jun 28, 2003 2:52 am   
 
Continuing with that script, there is something else which i'd like to do; See, when the trigger {You dig up Mitrill ore (**) and drop it on a stack!} comes up, the mud is actually reporting a number from 1 to 99.
What could i do to have the mud read the amount of resources which have been mined, and then use that exact number of ore in response to that trigger? such as :
{You dig up Mitrill ore (12) and drop it on a stack!} {get 12 'mitrill ore';put 12 'mitrill ore' container} - This way when mining with other players, i wouldnt be stealing anyone elses resources :)
Reply with quote
canute
Beginner


Joined: 19 Aug 2002
Posts: 11
Location: Canada

PostPosted: Sat Jun 28, 2003 3:32 am   
 
Ok, question regarding my first reply to myself, would i use
#class {mitrill}
#trigger {you get &ore ore and drop it on a stack} {get &ore}
#var ORE {}
#class {clay}
etc etc adding classes for each type of resource?

and for my first message, for each trigger, would i use

#IF (#IF (@line <> "you get &ore and drop it on a stack");#T+ mitrill;#T- copper;#T- clay;#T- limestone} (etc etc making a class for each mineral type, and then disabling each class) -

if i did this, #t+ mitrill, #t-everything else, when one of the others came up, like copper, (and i would have copper doing the same thing as mitrill) - would the triggers function in the future, or would i need to do this ---

#t+ mitrill, #t- everything else ---then perform action, such as get x amount of ore, /then after action performed/ #t+ everything, //end of action.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jun 28, 2003 9:14 am   
 
In Preferences (Prefs), you'll find a Spam Protection page under the General section. If you use that, you can drop the "inventory" from those triggers.

You can certainly use a variable instead of an actual direction.
#AL automine {#VAR minedirection %1;mine @minedirection}
#TR {You clear a path deeper into the layers of rock.} {mine @minedirection} {Mining}
#TR {Nothing to mine in that direction.} {automine %case( %random( 1, 6), north, south, east, west, up, down)} {Mining}
#TR {You stop mining...} {mine @minedirection} {Mining}

For the times when you dig things up, two sets of triggers seemed best, one to handle the "get;put portal" and one to handle the "mine". In your sample triggers there seemed to be four possibilities:
Mineral (clay)
Mineral amount (limestone 5)
Metal ore (copper ore)
Metal ore amount (mitrill ore 12)

I've assumed that when no amount is given, you dug up 1.
#TR {You dig up (%w) and drop it on a stack} {get 1 '%1';put 1 '%1' portal} {Mining}
#TR {You dig up (%w) ~((%d)~) and drop it on a stack} {get %2 '%1';put %2 '%1' portal} {Mining}
#TR {You dig up (%w ore) and drop it on a stack} {get 1 '%1';put 1 '%1' portal} {Mining}
#TR {You dig up (%w) and drop it on a stack} {get %2 '%1';put %2 '%1' portal} {Mining}

"Ignore previous line" is fairly difficult, it's much simpler to "ignore next line". I used the "Within" type of multi-state trigger with a parameter of 1 and NO ACTION (value). You should include as many #COND statements as the maximum number of resources you expect to receive from a single mining attempt (I assumed four). By using "Within|Param=1", the trigger should reset to the original state as soon as a non-matching line is received.
#TR {You dig up * and drop it on a stack} {mine @minedirection} {Mining}
#COND {You dig up * and drop it on a stack} {} {Within|Param=1}
#COND {You dig up * and drop it on a stack} {} {Within|Param=1}
#COND {You dig up * and drop it on a stack} {} {Within|Param=1}
Reply with quote
canute
Beginner


Joined: 19 Aug 2002
Posts: 11
Location: Canada

PostPosted: Sat Jun 28, 2003 7:18 pm   
 
cool :) thanks for the input and advice, gives me something to play with when i figure out what all the commands do :)

thanks!
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