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


Joined: 23 Aug 2013
Posts: 175

PostPosted: Mon Oct 28, 2013 9:35 pm   

If you have time, help me figure out why this wont compile please?
 
^{Wild Stag|Baby Dragon|Rabid Wolf|Sylvan Elf|Queen~'s Elite Guardswoman|Shadow Guard}.$

#var polmoba
#IF (%1 = "Wild Stag") {#va polmoba stag}
#IF (%1 = "Baby Dragon") {#VA polmoba dragon
#IF (%1 = "Rabid Wolf") {#VA polmoba wolf}
#IF (%1 = "Sylvan Elf") {#va polmoba elf}
#IF (%1 = "Queen's Elite Guardswoman") {#va polmoba woman}
#IF (%1 = "Shadow Guard") {#va polmob guard}
k %lower(@polmoba)
#t- polattk

that setup works for a number of other triggers i use to change the variable around, i could use %switch... but im not familiar with it so i dont. if anyone can come up with a working trigger/script i would greatly appreciate theirhelp:) ty ty.
Reply with quote
khil
Beginner


Joined: 18 Dec 2010
Posts: 17

PostPosted: Tue Oct 29, 2013 12:42 am   
 
You want something like this.

Code:
^({Wild Stag|Baby Dragon|Rabid Wolf|Sylvan Elf|Queen~'s Elite Guardswoman|Shadow Guard}).$


Code:

#switch (%ismember(%1, "Wild Stag|Baby Dragon|Rabid Wolf|Sylvan Elf|Queen's Elite Guardswoman|Shadow Guard"))
  (1) {#va polmoba stag}
  (2) {#va polmoba dragon}
  (3) {#VA polmoba wolf}
  (4) {#va polmoba elf}
  (5) {#va polmoba woman}
  (6) {#va polmob guard}
k %lower(@polmoba)
 


Although even easier would be:
Code:
k %lower(%word(%1, %numwords(%1)))


... if your MUD can tolerate "k guardswoman" instead of "k woman"
Very Happy Very Happy Very Happy
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Oct 29, 2013 3:46 am   
 
For the record, you can use strings in #switch:

Code:
#switch (%1)
  ("Wild Stag") {#va polmoba stag}
  ("Baby Dragon") {#va polmoba dragon}
  ("Rabid Wolf") {#VA polmoba wolf}
  ("Sylvan Elf") {#va polmoba elf}
  ("Queen's Elite Guardswoman") {#va polmoba woman}
  ("Shadow Guard") {#va polmoba guard}


Looks neater that way, in my opinion.
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sat Dec 07, 2013 12:01 pm   
 
hiyas If someone can still help with this, im getting compile errors again with the script provided, i'm very new to scripting (obviously) could someone show me complete example with %switch(#switch) please? ty ty
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Dec 07, 2013 7:18 pm   
 
I saw nothing in this thread that would indicate inability to compile. I would check for corruption.
_________________
EDIT: I didn't like my old signature
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Wed Jan 14, 2015 6:54 am   
 
reply sorry to take so long to get back....

i had to go with this instead

trigger -> ^!(*)$

script->
#IF %begins(%1, "Rabid") {monster = "wolf"}
#IF %begins(%1, "Sylvan Elf") {monster = "elf"}
#IF %begins(%1, "Baby Dragon") {monster = "dragon"}
#IF %begins(%1, "Faerie") {monster = "lizard"}
#IF %begins(%1, "Wyvern") {monster = "wyvern"}
#IF %begins(%1, "Shadow") {monster = "guard"}
#IF %begins(%1, "Guardian") {monster = "guardian"}
#IF %begins(%1, "Sylvan Demon") {monster = "demon"}
#IF %begins(%1, "Lesser") {monster = "demon"}
#IF %begins(%1, "Wild") {monster = "stag"}
#IF %begins(%1, "Warrior") {monster = "warrior"}
#IF %begins(%1, "Queen's") {monster = "guard"}
#IF %begins(%1, "Cleric") {monster = "cleric"}
#IF %begins(%1, "Evil Templar") {monster = "guard"}
#IF %begins(%1, "Ragged") {monster = "peasant"}
#IF %begins(%1, "Black Patrol") {monster = "guard"}
#IF %begins(%1, "Black Patrol Leader") {monster = "leader"}


then i just kill @monster
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