 |
Talahaski Enchanter
Joined: 10 Oct 2000 Posts: 656 Location: USA
|
Posted: Thu Apr 17, 2008 1:28 am
Help rewritting another trigger |
Can anybody help me rewrite this old zmud trigger to work with cmud
Pattern:
^({@SkillChecks/SkillListing}):%s({@SkillChecks/SkillRanks}).
Script:
tSkillName=%replace( %replace( %1, ">", ""))
tSkillName=%replace( %replace( %replace( %replace( %trim( @tSkillName), " ", "_"), "-", "_"), "#", "_"), "'", "_")
tSkillLevel=%replace( %replace( %replace( %replace( %replace( %trim( %2), " ", "_"), "-", "_"), "#", "_"), ">", "_"), "'", "_")
#IF (@{@tSkillLevel} > @{@tSkillName}) {
#ST @tSkillName @{@tSkillName}
#VAR @tSkillName @{@tSkillLevel}
}
#SUB {%format( "&26s &40s &8.0f", @tskillname, @tskilllevel, @{@tskillname})}
#math total_skill_points @total_skill_points+@{@tskillname}
Mud Displays Text such as:
enlarge: Excellent.
I know at some point I should throw this away and use a database to store this stuff, but I don't know how to work with database that well in CMUD just yet. |
|
_________________ Talahaski
dartmud.com 2525 |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Apr 17, 2008 10:25 am |
Get rid of all those nasty %replaces and replace (haha) them with %subchar(%trim(%2)," -#'>","_____") for the level and %subchar(%trim(%2)," -#'>","____") for the name. Note the number of underscores - characters without a replacement character are deleted.
I can't spot any glaring errors - my suspicion, if it's not working, is that it's something to do with the indirection, perhaps your #var @tSkillName line. Unfortunately, I can't check right now - no access to CMUD - but I will this evening unless someone beats me. |
|
|
 |
Talahaski Enchanter
Joined: 10 Oct 2000 Posts: 656 Location: USA
|
Posted: Fri Apr 18, 2008 12:01 am |
Thanks Fang, I got it working now.
Corrected version:
SkillChecks/SkillPoints/tSkillName=%subchar(%trim(%1)," -#'>","_____")
SkillChecks/SkillPoints/tSkillLevel=%subchar(%trim(%2)," -#'>","_____")
#IF (@{@tSkillLevel} > @{@tSkillName}) {
#SH changing @tSkillName from @{@tSkillName} to @{@tSkillLevel}
#var @tSkillName @{@tSkillLevel} {_nodef} {SkillChecks|SkillCountVariables}
}
#SUB {%format( "&26s &40s &8.0f", @tskillname, @tskilllevel, @{@tskillname})} |
|
_________________ Talahaski
dartmud.com 2525 |
|
|
 |
Talahaski Enchanter
Joined: 10 Oct 2000 Posts: 656 Location: USA
|
Posted: Fri Apr 18, 2008 12:23 am |
Oh, did #ST change?
I believe it used to replace any existing status bar, but now everytime a #ST is executes it creates a new status bar object and I end up with tons of them. |
|
_________________ Talahaski
dartmud.com 2525 |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Apr 18, 2008 1:10 am |
Yeah, it did. You need to specify an id now (see the #status help file for that) so that it's always the same entry that's overwritten. Perhaps an easier way, though, is to store your string in a variable and then have the status window just display the contents of the variable.
|
|
|
 |
|
|
|
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
|
|