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


Joined: 26 Feb 2009
Posts: 27

PostPosted: Thu Feb 26, 2009 11:20 pm   

New to running operations
 
In my MUD, I have weapons that disintegrate (sometimes right in the middle of combat). To compound the problem, I have a number of weapons that disintegrate, and various sizes they can be. In general I can count on size giant, but that still leaves the variety. Up 'till now I've mitigated this by using a number of variables and triggers.

triggers
"disintegrates"
variable "geoquip" to no

Every now and then (prompt or so) I have six triggers that checks geoweapon for the type of weapon, and geoquip for yes or no, if no, the appropriate trigger fires and sequences a re-equip sequence to keep a weapon in my hand.

Aliases
You wield X (for all six weapons, wielding that weapon sets the variable geoweapon to the type wielded)

My question, is there a way I can make a trigger that checks for all types, and applies the appropriate alias to re-equip myself?

IE: What's the proper way to do-

#IF (@geoquip = no) {xequip/yequip/aequip/bequip/etc}

X, Y, A, and B being the varying types of weapons I can conjure.

Also, how can I reduce the "You wield X" into one trigger that sets the variable?

Instead of
Pattern: "You wield a cobra lash"
Trigger: #var geoweapon cobra
Can I
Pattern: "You wield (*)"
Trigger: #if (%1 = "a cobra lash"/"the impact spear"/"etc"/"etc") {#var geoweapon "cobra"/"impact"/"etc"/"etc"}
and make the appropriate value appear in the variable based off of the position of the variable in the "If true" statement?

I'm a noob at coding, I hope what I explained here can lead to a solution
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Feb 26, 2009 11:41 pm   
 
What exact syntax fires the first part? Sounds like you could do with an %ismember function.

For the second part, you can use %iskey.

#TRIGGER {You wield (*)} {#IF %iskey(@Weapontypes, %1) {#VAR geoweapon %db(@Weapontypes, %1)}}

You'd have to set up the @Weapontypes variable, though, and you can do so like this:

#ADDKEY Weapontypes "a cobra lash" "cobra"
#ADDKEY Weapontypes "an impact spear" "impact"

and so forth.

Hope that helps a bit.

Charneus
Reply with quote
Khana
Beginner


Joined: 26 Feb 2009
Posts: 27

PostPosted: Fri Feb 27, 2009 12:03 am   
 
Interesting, I'll have to explore the %iskey and #addkey functions more, thanks. To answer your question I use "(*) has turned to dust." to begin the sequence, since that's the line of my weapons disintegrating.

I'll have to explore the iskey and ismember functions in order to understand what you mean, I appreciate the push in the right direction. I'll let you know if I run into any more hangups.
Reply with quote
Khana
Beginner


Joined: 26 Feb 2009
Posts: 27

PostPosted: Fri Feb 27, 2009 12:05 am   
 
Okay so my understanding so far is that iskey checks the things within the ()'s to see if %1 matches a line in "Weapontypes," if it does, it changes geoweapon to %1?
Reply with quote
Khana
Beginner


Joined: 26 Feb 2009
Posts: 27

PostPosted: Fri Feb 27, 2009 12:09 am   
 
Okay, I figured out everything for the trigger that defines what geomancer weapon I'm holding, thanks alot! I'll try and use the same command for figuring out which alias I have to use to re-equip myself.

How do I set a true statement up to choose randomly from a series of commands? IE:

Trigger: Blah walks in.

You say 'Hello!'/You say 'Greetings!'/You say 'Ahoy there'
and so on

And one more request.

I'd like multiple true statements, but in an ascending order without multiple #IF arguements, my current set up is:

#IF ((@forceglobe = Unshielded) and (@ctype = muser)) {cast globe}
#IF ((@Mana > @stol) and (@HP > 50) and (@spellmode = on) and (@ctype = muser)) {c @ospell} {@downing}

It casts a shield spell if I'm unshielded, then checks my mana, HP, and a spellmode variable to tell if I cast a spell, or a knock down ability. My question here is, do I have to have two if statements (leading to both commands) or can I combine them into one, so that I either cast globe, OR try to spell or knock down?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Feb 27, 2009 9:18 am   
 
%item, %numitems and %random should do what you need. Consider the following

Code:
 #echo %item(@CommandList,%random(0,%numitems(@CommandList)))
_________________
Asati di tempari!
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Feb 27, 2009 2:59 pm   
 
For the last question, you could use nested #if statements, or you could use a #switch command:
Code:

#switch (@forceglobe = Unshielded and @ctype = muser) {cast globe}
  (@Mana > @stol and @HP > 50 and @spellmode = on and @ctype = muser) {c @ospell}
  {@downing}
Reply with quote
Khana
Beginner


Joined: 26 Feb 2009
Posts: 27

PostPosted: Sat Feb 28, 2009 7:33 pm   
 
Thanks Rahab, I'll look into the #switch command
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