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
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Wed Apr 09, 2008 1:34 am   

Trigger not working
 
I have not been mudding in a long time, but recently decided to try to get back into it.

I loaded cmud and upgraded all my old scripts, but many of them no longer work/compile.

This one I cannot figure out what the problem is.

trigger pattern:
~* You think your%s({@SkillChecks/SkillListing})%sskill has improved. ~*$

script:
#PRIORITY {
#VARIABLE SkillIncreased {%1} {_nodef} {SkillChecks}
#VARIABLE OriginalSkillIncreased {%1} {_nodef} {SkillChecks}
#VARIABLE SkillIncreased {%replace( %replace( %replace( %replace( @SkillChecks/SkillIncreased, " ", "_"), "'", "_"), "-", "_"), "#", "_")} {_nodef} {SkillChecks}
#VAR @SkillChecks/SkillIncreased %eval(@{SkillChecks/SkillCountVariables/@SkillChecks/SkillIncreased}+1) {_nodef} {SkillChecks|SkillCountVariables}
#IF (@SkillChecks/PlussOn=1) {
#IF (@MagicWork/QueuedCommands/RecordQc=0) {
show skills @OriginalSkillIncreased
say + @OriginalSkillIncreased
} {
Qc show skills @OriginalSkillIncreased
Qc say + @OriginalSkillIncreased
}
}
#COLOR 11
update_time
}


test pattern:
* You think your teaching skill has improved. *

Compile Code says there is a missing bracket, but there is not.

Also this line used to be in the script, but it appearently is not working either.
:skills:#sh @OriginalSkillIncreased @{@OriginalSkillIncreased}

was suppose to write to a window the skill name and the point value.



oh, and hello again zugg, been a long time. I used to be very active on your boards up to about 1 1/2 years ago when I gave up mudding.
_________________
Talahaski


dartmud.com 2525
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Wed Apr 09, 2008 1:46 am   
 
don't look at the signature, it has not been updating in a long time.

I'm running cmud on vista.
_________________
Talahaski


dartmud.com 2525
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Apr 09, 2008 2:02 am   
 
Laughing

I may have been the only one to see that.

Two things.

First, priority no longer exists.

Second, you are using implicit concatenation. Implicit concatenation is frowned upon in CMUD. Don't get me wrong it sometimes works. This just happens to be one of the places it does not.

#VAR @SkillChecks/SkillIncreased %eval( @{%concat("SkillChecks/SkillCountVariables/",@SkillChecks/SkillIncreased)}+1) {_nodef} {SkillChecks|SkillCountVariables}

Should fix the problem once you have also removed the #priority.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Wed Apr 09, 2008 2:10 am   
 
Thanks for the help.

was priority replaced by anything, any reason why it was dropped?
_________________
Talahaski


dartmud.com 2525
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Apr 09, 2008 2:18 am   
 
You really should read the changes for Zmud users section of the documentation. priority

Basically, #priority was created as a way to deal with things like #wait and the lack of multi-threading in Zmud.
Cmud has multi-threading and #wait works differently.

The documentation is still a little obscure but it is better than it was back when last you frequented the forums.
There are also places for us to add comments to the help files and those can be helpful too.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Apr 09, 2008 10:19 am   
 
I would also suggest changing these lines
Code:
#VARIABLE SkillIncreased {%1} {_nodef} {SkillChecks}
#VARIABLE SkillIncreased {%replace( %replace( %replace( %replace( @SkillChecks/SkillIncreased, " ", "_"), "'", "_"), "-", "_"), "#", "_")} {_nodef} {SkillChecks}
to
Code:
#VARIABLE SkillIncreased {%subchar( %1, " '-#", "____")} {_nodef} {SkillChecks}
That is just a readability thing.

For the line
Code:
:skills:#sh @OriginalSkillIncreased @{@OriginalSkillIncreased}
Use the #WINDOW command
Code:
#WINDOW skills {@OriginalSkillIncreased @{@OriginalSkillIncreased}}
There is a certain amount of scoping in CMud to make packages work with each other when variable and class names may conflict. This was done so that a user can grab packages from the library from multiple authors and not have trouble using them. Naming conflicts can still occur and it the responsibility of package authors to use good naming methods, but the scoping is pretty close to perfect.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 09, 2008 5:03 pm   
 
Oh my, Talahaski! I wondered where you'd gone. Now I definitely have to get my Dartmud skill tracking package revised and posted on the package library so you can check it out. It should have a number of features you don't have.
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Sun Apr 27, 2008 5:45 pm   
 
I've been cleaning this up a lot more.

For anybody following this thread, here is my updated trigger now using local variables.

$SkillIncreased=%subchar(%trim(%1)," -#'>","_____")
#VAR %concat("@",$SkillIncreased) %eval( @{%concat("SkillChecks/SkillCountVariables/",$SkillIncreased)}+1) {_nodef} {SkillChecks|SkillCountVariables}
#Window skills %1 @{%concat("SkillChecks/SkillCountVariables/",$SkillIncreased)}
#Switch (@SkillChecks/PlussOn)
(1) {Qc show skills %1
Qc say + %1
QcCommand}
(2) {Qc show skills %1
QcCommand}
#COLOR 11
_________________
Talahaski


dartmud.com 2525
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