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


Joined: 13 Feb 2022
Posts: 13

PostPosted: Sat Apr 02, 2022 12:51 am   

Converting targeting system from Zmud which works like a Champ to CmuD.
 
Ok boys & girls converting is a nightmare. This is what I have which works well in zmud, can't get past line 3 to compile in Cmud.

CLASS {targetsystem}
#ALIAS targ2 {#echo @Targets2}
#ALIAS targ {#echo @Targets}
#ALIAS at2 {
#if {%ismember( %lower( %1), @Targets2)} {#show %lower( %1) is on the target list already.} {Targets2=%insert%lower( %1)@Targets2}
#show Added %lower( %1) to List of Targets2.
}
#ALIAS dt2 {#if {%ismember( %lower( %1), @Targets2)} {
Targets2=%delitem( %lower( %1), @Targets2)
#show Removed %lower( %1) from List of Targets2.
} {#show %lower( %1) wasn't on the target list.}}
#ALIAS 9 {@targets2 = ""}
#ALIAS h {
#IF (@Targets2 = "") {} {#LOO 1,%numwords( @Targets2, |) {earthen hammer %item( @Targets2, %i)}}
#IF (@Targets2 = "") {} {#LOO 1,%numwords( @Targets2, |) {maul %item( @Targets2, %i)}}
}
#ALIAS p {
#IF (@Targets2 = "") {} {#LOO 1,%numwords( @Targets2, |) {cast corrode %item( @Targets2, %i)}}
#IF (@Targets2 = "") {} {#LOO 1,%numwords( @Targets2, |) {cast engulf %item( @Targets2, %i)}}
#IF (@targets2 = "") {} {#LOO 1,%numwords( @targets2, |) {cast earthen hammer %item( @targets2, %i)}}
#IF (@targets2 = "") {} {#LOO 1,%numwords( @targets2, |) {maul %item( @targets2, %i)}}
}
#ALIAS at {
#if {%ismember( %lower( %1), @Targets)} {#show %lower( %1) is on the target list already.} {Targets=%insert%lower( %1)@Targets}
#show Added %lower( %1) to List of Targets.
}
#ALIAS dt {#if {%ismember( %lower( %1), @Targets)} {
Targets=%delitem( %lower( %1), @Targets)
#show Removed %lower( %1) from List of Targets.
} {#show %lower( %1) wasn't on the target list.}}
#ALIAS 0 {@targets = ""}
#ALIAS j {
#IF (@targets = "") {} {#LOO 1,%numwords( @targets, |) {earthen hammer %item( @targets, %i)}}
#IF (@targets = "") {} {#LOO 1,%numwords( @targets, |) {maul %item( @targets, %i)}}
}
#ALIAS pk {
sk
#IF (@targets = "") {} {#LOO 1,%numwords( @targets, |) {cast engulf %item( @targets, %i)}}
#IF (@targets = "") {} {#LOO 1,%numwords( @targets, |) {cast corrode %item( @targets, %i)}}
#IF (@targets = "") {} {#LOO 1,%numwords( @targets, |) {cast earthen hammer %item( @targets, %i)}}
#IF (@targets = "") {} {#LOO 1,%numwords( @targets, |) {maul %item( @targets, %i)}}
}
#VAR targets {}
#CLASS 0
Reply with quote
Wspaedt1977
Beginner


Joined: 13 Feb 2022
Posts: 13

PostPosted: Sat Apr 02, 2022 3:08 am   
 
Ok will a little time playing with it. I got everything to work but the
#ALIAS 9 {@targets2 = ""}
#ALIAS 0 {@targets = ""}

These two functions.... These should clear the two variables out but for some reason don't seem to be. Any suggestions as to why??
I have a feeling cmud doesn't like ""
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Sat Apr 02, 2022 9:39 am   
 
Use %null to clear the variable.

@targets2 = %null
@targets = %null
Reply with quote
shalimar
GURU


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

PostPosted: Sat Apr 02, 2022 9:07 pm   
 
#if {%ismember( %lower( %1), @Targets2)}
needs to be

#if (%ismember( %lower( %1), @Targets2))

for all the at dt aliases

also, alias names that start with a numeral are not allowed in CMUD
_________________
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