Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
BlackSmith
Apprentice


Joined: 08 Dec 2002
Posts: 152

PostPosted: Mon Oct 16, 2006 9:32 pm   

What was the right conversion method for {}
 
I have lot of #Substitute's and #Alarm's thus i use {} lot, and every trig that has either simply does not work.
So how should i convert em?
_________________
BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Oct 16, 2006 10:32 pm   
 
I think you'd have to give us an example of how you're using curly braces that doesn't work in CMUD. There are obviously many times when you should use them, as that's a primary delimiter of the syntax. CMUD's text editor with the syntax highlighting might help you discern what you need, too.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Oct 17, 2006 12:12 am   
 
You should be putting {} around the Pattern for Triggers/Alarms and around any list of commands. You also use {} to represent a string where you want variables within the {} to be expanded. You shouldn't put {} around the trigger or alarm "id" value.

So, it should be a syntax like this:

#ALARM {pattern} {commands}
Reply with quote
BlackSmith
Apprentice


Joined: 08 Dec 2002
Posts: 152

PostPosted: Tue Oct 17, 2006 6:03 am   
 
Well here is a one that has both.
Code:
#AddKey Battle Boolean 1
#Add Battle.Rounds 1
#Substitute {@Time.Hours:@Time.Minutes:@Time.Seconds |  B A T T L E  R O U N D  @Battle.Rounds | %if(%mod(@Battle.Rounds,2), Scanning target, Scanning all)}
#Alarm +.5 {
 #If ((@Hp.Current * 5 <= @Hp.Max * 3) & @Party.Boolean) {
  #Send {party report}
 }
 #Case (%mod(@Battle.Rounds,2)) {
  #Send {scan}
  } {
  #Send {scan all}
 }
}
Works like a charm in zMud but cMud says
Quote:
Error compiling script:
extra } brace

..But with Zugg's advice adding {} around the #Alarm pattern seems to do the trick.
IF color html code did not work (yet) then i might have a clue why the substitute ones bug. Because e.g. this does not work
Code:
\s+Hp:([+-]?[0-9]+)/(\d+)\s

#if (%1 != @Hp.Current) {
 #math (Hp.Difference) {%1 - @Hp.Current}
 #substitute {%Char(32)Hp:%1%Char(40)%If(0<@Hp.Difference, <color green>+, <color red>)@Hp.Difference</color>%Char(41)%2%Char(32)}
 }
#AddKey Hp Current %1
#AddKey Hp Max %2
Edit: i tested to remove all but the addkeys and still it did not work :-/
_________________
BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Tue Oct 17, 2006 2:16 pm   
 
The new multiline syntax is broken and we have gone over it in another thread. And we have found two temporary fixes for this.

My fix was to use spaces to control this. http://forums.zuggsoft.com/phpbb/viewtopic.php?t=25033
Guinn used a ; http://forums.zuggsoft.com/phpbb/viewtopic.php?t=25046 His way is easier...
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Oct 17, 2006 4:56 pm   
 
Also, you should put quotes around the literal strings in your %If statement:

%If(0<@Hp.Difference, "+", "")

especially when it contains special characters like <, > and +
Reply with quote
BlackSmith
Apprentice


Joined: 08 Dec 2002
Posts: 152

PostPosted: Tue Oct 17, 2006 5:50 pm   
 
Arminas wrote:
The new multiline syntax is broken and we have gone over it in another thread.
Ummm... I'm not using that? I have all my stuff "coded" like that in zMud and they roll nicely. Or am i?
Zugg wrote:
Also, you should put quotes around the literal strings in your %If statement:

%If(0<@Hp.Difference, "<color green>+", "<color red>")

especially when it contains special characters like <, > and +
Didnt help.
_________________
BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Tue Oct 17, 2006 6:09 pm   
 
You are using multiple lines.

And, since Zugg mentioned those things, you probably need to follow both peices of advice for it to work properly.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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