|
kyros Novice
Joined: 26 Jan 2005 Posts: 33
|
Posted: Sun Jan 06, 2008 12:40 am
Help converting zmud script to cmud. |
I had help with this script awhile back for zmud, since I got cmud, I was wondering if someone could help me convert it to cmud. Since i am inexpirienced with cmud's scripting engine. It's similar, but it isn't the same.
here is the script:
Code: |
#CLASS {SexLoc}
#ALIAS sexlocedit {
#if (%lower( %1)=add) {
#if (%2=%null) {
#say
#say
#say
#say %ansi( red, high)Error~: Please type in a location name. Ex: sexlocadd vospire 312 1177
" "
} {
#if (%3=%null) {
#say
#say
#say
#say %ansi( red, high)Error~: Please type in a longitude value. Ex: sexlocadd vospire 312 1177
" "
} {
#if (%4=%null) {
#say
#say
#say
#say %ansi( red, high)Error~: Please type in a latitude value. Ex: sexlocadd vospire 312 1177
" "
} {
#if (%ismember( %2, @places)) {
#say
#say
#say
#say %ansi( yellow, high)Warning~: Location exists. To add or change the location, please delete the location first using the sexloc del command.
" "
} {
#if (%isnumber( %3) and %isnumber( %4) and %3<2300 and %4<1500) {
#VAR %lower( %2) "%ansi( blue, high)Your destination is currently %ansi( cyan, high)%2%ansi( blue, high), located at %ansi( defcol)%3%ansi( blue, high),%ansi( defcol) %4%ansi( blue, high)." {} {Scripts|SexLoc|Svariables}
#ADDITEM places %lower( %2)
#say
#say
#say
#say %ansi( high, green)Success~: You have saved the new location %2 to your database.
" "
} {
#say
#say
#say
#say %ansi( red, high)Error~: Please type in a proper numeric value. Make sure your command is proper and does not exceed the number of rooms in Alyria. Ex: sexlocadd vospire 312 1177
" "
}
}
}
}
}
}
#if (%lower( %1)=delete) {
#if (%2=null) {
#say
#say
#say
#say %ansi( red, high)Error: You need to specifiy an area to delete. EX: sexloc delete vospire.
" "
} {
#if (%ismember( %2, @places)) {
#DELITEM places %lower( %2)
#UNVAR %lower( %2) {Scripts|SexLoc|Svariables}
#say
#say
#say
#say %ansi( high, green)Success~: You have deleted the location from the database.
" "
} {
#say
#say
#say
#say %ansi( high, red)Error~: Location does not exist in the database.
" "
}
}
}
#if (%lower( %1)=add or %lower( %1)=delete) {} {
#say
#say
#say
#say %ansi( high, red)Error~: You can either add or delete an area with this function. Please type, sexloc add or sexloc delete for more details.
" "
}
}
#ALIAS sexloc {
#T+ {sexloc|Striggers}
#T+ {sexloc|Salias}
#if (@%1=%null) {
#say
#say
#say
#say %ansi( red, high)I am sorry but you have entered an invalid location. To see a list of locations, please type~: %ansi( white, high)sexloc locations%ansi( red, high).
""
} {
#var location "@%1"
#var sexloc "%lower(@%1)"
read sextant
}
#alarm +1 {#t- {sexloc|Striggers}}
#alarm +1 {#t- {sexloc|Salias}}
}
#CLASS 0
#CLASS {SexLoc|Svariable}
#VAR sigil {%ansi( blue, high)Your destination is currently %ansi( green, high)Sigil%ansi( blue, high), located at %ansi( defcol)435%ansi( blue, high),%ansi( defcol) 1226%ansi( blue, high).}
#VAR rune {%ansi( blue, high)Your destination is currently %ansi( green, high)Rune%ansi( blue, high), located at %ansi( defcol)695%ansi( blue, high),%ansi( defcol) 770%ansi( blue, high).}
#VAR arcane {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Arcane Archipelago%ansi( blue, high), located at %ansi( defcol)926%ansi( blue, high),%ansi( defcol) 816%ansi( blue, high).}
#VAR vospire {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Vospire%ansi( blue, high), located at %ansi( defcol)312%ansi( blue, high),%ansi( defcol) 1177%ansi( blue, high).}
#VAR atlantis {%ansi( blue, high)Your destination is currently %ansi( cyan, high)the Lost City of Atlantis%ansi( blue, high), located at %ansi( defcol)1988%ansi( blue, high),%ansi( defcol) 1305%ansi( blue, high).}
#VAR seahag {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Isle of the Seahag%ansi( blue, high), located at %ansi( defcol)1113%ansi( blue, high),%ansi( defcol) 873%ansi( blue, high).}
#VAR tellerium {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Tellerium%ansi( blue, high), located at %ansi( defcol)1724%ansi( blue, high),%ansi( defcol) 685%ansi( blue, high).}
#VAR templeton {%ansi( blue, high)Your destination is currently %ansi( green, high)Templeton%ansi( blue, high), located at %ansi( defcol)1619%ansi( blue, high),%ansi( defcol) 540%ansi( blue, high).}
#VAR nr {%ansi( blue, high)Your destination is currently %ansi( green, high)New Rigel%ansi( blue, high), located at %ansi( defcol)801%ansi( blue, high),%ansi( defcol) 545%ansi( blue, high).}
#VAR pg {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Proving Grounds Reef Entrance%ansi( blue, high), located at %ansi( defcol)1268%ansi( blue, high),%ansi( defcol) 748%ansi( blue, high).}
#VAR pc {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Pirate's Cove%ansi( blue, high), located at %ansi( defcol)1191%ansi( blue, high),%ansi( defcol) 968%ansi( blue, high).}
#VAR mkeep {%ansi( blue, high)Your destination is currently %ansi( red, high)Maldra's Keep%ansi( blue, high), located at %ansi( defcol)1304%ansi( blue, high),%ansi( defcol) 1092%ansi( blue, high).}
#VAR toa {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Tower of Art%ansi( blue, high), located at %ansi( defcol)1271%ansi( blue, high),%ansi( defcol) 211%ansi( blue, high).}
#VAR nk {%ansi( blue, high)Your destination is currently %ansi( red, high)New Kolvir%ansi( blue, high), located at %ansi( defcol)571%ansi( blue, high),%ansi( defcol) 984%ansi( blue, high).}
#VAR bazaar {%ansi( blue, high)Your destination is currently %ansi( cyan, high)the Bazaar%ansi( blue, high), located at %ansi( defcol)818%ansi( blue, high),%ansi( defcol) 386%ansi( blue, high).}
#VAR dio {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Diocletian%ansi( blue, high), located at %ansi( defcol)553%ansi( blue, high),%ansi( defcol) 1360%ansi( blue, high).}
#VAR low {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Lowangen%ansi( blue, high), located at %ansi( defcol)1159%ansi( blue, high),%ansi( defcol) 421%ansi( blue, high).}
#VAR ov {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Ogre Village%ansi( blue, high), located at %ansi( defcol)1885%ansi( blue, high),%ansi( defcol) 459%ansi( blue, high).}
#VAR ctf {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Capture The Flag Arena%ansi( blue, high), located at %ansi( defcol)993%ansi( blue, high),%ansi( defcol) 893%ansi( blue, high).}
#VAR deceit {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Dungeon Deceit%ansi( blue, high), located at %ansi( defcol)1254%ansi( blue, high),%ansi( defcol) 1071%ansi( blue, high).}
#VAR thorne {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Desert Thorne%ansi( blue, high), located at %ansi( defcol)1031%ansi( blue, high),%ansi( defcol) 316%ansi( blue, high).}
#VAR fgk {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Frost Giant's Keep%ansi( blue, high), located at %ansi( defcol)1689%ansi( blue, high),%ansi( defcol) 389%ansi( blue, high).}
#VAR kessarian {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Kessarian's Dungeon%ansi( blue, high), located at %ansi( defcol)1590%ansi( blue, high),%ansi( defcol) 985%ansi( blue, high).}
#VAR lonelydragon {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Lonely Dragon Inn%ansi( blue, high), located at %ansi( defcol)600%ansi( blue, high),%ansi( defcol) 700%ansi( blue, high).}
#VAR maelstrom {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Maelstrom%ansi( blue, high), located at %ansi( defcol)1540%ansi( blue, high),%ansi( defcol) 742%ansi( blue, high).}
#VAR magencia {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Magencia%ansi( blue, high), located at %ansi( defcol)865%ansi( blue, high),%ansi( defcol) 834%ansi( blue, high).}
#VAR mandrake {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Mandrake Woods%ansi( blue, high), located at %ansi( defcol)654%ansi( blue, high),%ansi( defcol) 365%ansi( blue, high).}
#VAR relic {%ansi( blue, high)Your destination is currently %ansi( yellow, high)Relic Binding Gate%ansi( blue, high), located at %ansi( defcol)1804%ansi( blue, high),%ansi( defcol) 924%ansi( blue, high).}
#VAR runeforest {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Rune Forest%ansi( blue, high), located at %ansi( defcol)701%ansi( blue, high),%ansi( defcol) 680%ansi( blue, high).}
#VAR boars {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Tavern of the Boars%ansi( blue, high), located at %ansi( defcol)797%ansi( blue, high),%ansi( defcol) 445%ansi( blue, high).}
#VAR aroxa {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Tower of Aroxa%ansi( blue, high), located at %ansi( defcol)1759%ansi( blue, high),%ansi( defcol) 730%ansi( blue, high).}
#VAR retreat {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Traveller's Retreat%ansi( blue, high), located at %ansi( defcol)776%ansi( blue, high),%ansi( defcol) 651%ansi( blue, high).}
#VAR vesuvius {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Vesuvius%ansi( blue, high), located at %ansi( defcol)295%ansi( blue, high),%ansi( defcol) 1160%ansi( blue, high).}
#VAR twinmoons {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Twin Moons Inn%ansi( blue, high), located at %ansi( defcol)1007%ansi( blue, high),%ansi( defcol) 306%ansi( blue, high).}
#VAR wroth {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Dungeon Wroth%ansi( blue, high), located at %ansi( defcol)736%ansi( blue, high),%ansi( defcol) 391%ansi( blue, high).}
#VAR xaventry {%ansi( blue, high)Your destination is currently %ansi( white, high)Xaventry%ansi( blue, high), located at %ansi( defcol)602%ansi( blue, high),%ansi( defcol) 454%ansi( blue, high).}
#VAR hellbent {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Hellbent Mountain%ansi( blue, high), located at %ansi( defcol)1342%ansi( blue, high),%ansi( defcol) 365%ansi( blue, high).}
#VAR colyon {%ansi( blue, high)Your destination is currently %ansi( cyan, high)The Village of Colyon%ansi( blue, high), located at %ansi( defcol)1383%ansi( blue, high),%ansi( defcol) 1029%ansi( blue, high).}
#VAR jalur {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Jalur Lumber Camp%ansi( blue, high), located at %ansi( defcol)1814%ansi( blue, high),%ansi( defcol) 255%ansi( blue, high).}
#VAR mulak {%ansi( blue, high)Your destination is currently %ansi( cyan, high)The Village of Mulakanathos%ansi( blue, high), located at %ansi( defcol)1554%ansi( blue, high),%ansi( defcol) 1234%ansi( blue, high).}
#VAR winton {%ansi( blue, high)Your destination is currently %ansi( cyan, high)The Hamlet of Winton%ansi( blue, high), located at %ansi( defcol)1582%ansi( blue, high),%ansi( defcol) 392%ansi( blue, high).}
#VAR locations {Valid destinations are: Arcane, Aroxa, Atlantis, Avarice, Armegeddon, Bazaar, Boars, Colyon, CTF, Deceit, Dio, Daggerwind, Emperor, Federation, FGK, Hellbent, Heros, Immortal, Jalur, LonelyDragon, Low, Maelstrom, Magencia, Mandrake, MKeep, Mulak, NK, NR, OV, PC, PG, Pelican, Relic, Reef, Retreat, Rune, RuneForest, Sigil, Stargazer, Tellerium, Templeton, Teolaven, ToA, TwinMoons, Thorne, Vesuvius, Vospire, Wench, Winton, Wroth, and Xaventry.}
#VAR stargazer {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Old Stargazer Clanhall%ansi( blue, high), located at %ansi( defcol)1707%ansi( blue, high),%ansi( defcol) 438%ansi( blue, high).}
#VAR location {@sigil}
#VAR places {sigil|rune|arcane|vospire|atlantis|seahag|tellerium|templeton|nr|pg|pc|mkeep|toa|nk|bazaar|dio|low|ov|ctf|deceit|thorne|fgk|ctf|malestrom|magencia|mandrake|relic|runeforest|boars|aroxa|retreat|vesuvius|twinmoons|unseelie|wroth|xaventry|hellbent|colyon|jalur|mulak|winton|stargazer|avarice|federation|armageddon|emperor|heros|reef|teolaven|wench|immortal|daggerwind|pelican}
#VAR avarice {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Dungeon Avarice%ansi( blue, high), located at %ansi( defcol)671%ansi( blue, high),%ansi( defcol) 512%ansi( blue, high).}
#VAR federation {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Old Federation Clanhall%ansi( blue, high), located at %ansi( defcol)874%ansi( blue, high),%ansi( defcol) 233%ansi( blue, high).}
#VAR armageddon {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Old Armageddon Clanhall%ansi( blue, high), located at %ansi( defcol)515%ansi( blue, high),%ansi( defcol) 1411%ansi( blue, high).}
#VAR emperor {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Emperor's Crossroads%ansi( blue, high), located at %ansi( defcol)506%ansi( blue, high),%ansi( defcol) 1309%ansi( blue, high).}
#VAR heros {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Hall of Heros%ansi( blue, high), located at %ansi( defcol)697%ansi( blue, high),%ansi( defcol) 741%ansi( blue, high).}
#VAR reef {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Reef Entrancec%ansi( blue, high), located at %ansi( defcol)1268%ansi( blue, high),%ansi( defcol) 748%ansi( blue, high).}
#VAR teolaven {%ansi( blue, high)Your destination is currently %ansi( cyan, high)The Village of Teolaven%ansi( blue, high), located at %ansi( defcol)609%ansi( blue, high),%ansi( defcol) 1303%ansi( blue, high).}
#VAR wench {%ansi( blue, high)Your destination is currently %ansi( cyan, high)The Wreck of the Fiesty Wench%ansi( blue, high), located at %ansi( defcol)1889%ansi( blue, high),%ansi( defcol) 955%ansi( blue, high).}
#VAR immortal {%ansi( blue, high)Your destination is currently %ansi( cyan, high)The Immortal City%ansi( blue, high), located at %ansi( defcol)571%ansi( blue, high),%ansi( defcol) 984%ansi( blue, high).}
#VAR daggerwind {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Daggerwind Reef%ansi( blue, high), located at %ansi( defcol)2090%ansi( blue, high),%ansi( defcol) 1388%ansi( blue, high).}
#VAR pelican {%ansi( blue, high)Your destination is currently %ansi( cyan, high)Pelican's Demise%ansi( blue, high), located at %ansi( defcol)1580%ansi( blue, high),%ansi( defcol) 938%ansi( blue, high).}
#VAR CUR_X {1619}
#VAR CUR_Y {540}
#VAR DEST_X {435}
#VAR DEST_Y {1226}
#VAR DELTA_X {1116}
#VAR DELTA_Y {686}
#VAR DIR_X { East}
#VAR DIR_Y { South}
#CLASS 0
#CLASS {SexLoc|Striggers}
#TRIGGER {^Your destination is currently *, located at (%n), (%n).} {
#var DEST_X %1
#var DEST_Y %2
howfar
}
#TRIGGER {^You are currently at position (%n), (%n)} {
#say @location
#VAR CUR_X %1
#VAR CUR_Y %2
}
#CLASS 0
#CLASS {SexLoc|Salias}
#ALIAS howfar {
#MATH DELTA_X (@DEST_X - @CUR_X)
#MATH DELTA_Y (@DEST_Y - @CUR_Y)
#IF (@DELTA_X > 1150) {#MATH DELTA_X (@DELTA_X - 2300)} {#IF (@DELTA_X < -1150) {#MATH DELTA_X (@DELTA_X + 2300)}}
#IF (@DELTA_Y > 750) {#MATH DELTA_Y (@DELTA_Y - 1500)} {#IF (@DELTA_Y < -750) {#MATH DELTA_Y (@DELTA_Y + 1500)}}
#VAR DIR_X {%if( @DELTA_X <> 0, %if( @DELTA_X > 0, " East", " West"))}
#MATH DELTA_X (%abs( @DELTA_X))
#VAR DIR_Y {%if( @DELTA_Y <> 0, %if( @DELTA_Y > 0, " South", " North"))}
#MATH DELTA_Y (%abs( @DELTA_Y))
#IF (@DELTA_X = 0 and @DELTA_Y = 0) {#ECHO %ansi( blue, high)Estimated rooms to travel: %ansi( defcol)You have reached your chosen destination.} {#ECHO %ansi( blue, high)Estimated rooms to travel: %if( @DELTA_X > 0, %ansi( defcol)@DELTA_X@DIR_X%ansi( blue, high))%if( @DELTA_Y > 0, %if( @DELTA_X > 0, ", ")%ansi( defcol)@DELTA_Y@DIR_Y%ansi( blue, high)).}
}
#CLASS 0 |
If someone could help me out with this, it would be awesome. Thanks. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jan 06, 2008 1:09 am |
Seems to be compiling okay. You might get some milage out of the #switch command and using local variables where possible, but those aren't necessary to make it work.
|
|
|
|
kyros Novice
Joined: 26 Jan 2005 Posts: 33
|
Posted: Sun Jan 06, 2008 1:50 am |
I tried to import the script twice, but it wouldn't work. Is there something I am missing?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jan 06, 2008 6:45 am |
What do you mean by import? All I did was paste what you have there on the command line and hit enter, and it worked fine.
|
|
|
|
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Sun Jan 06, 2008 8:42 pm |
kyros, the only type of file the new package editor will import is an xml file. Your settings are in text format so can't be directly imported and need to be entered on the command line like Fang mentioned.
|
|
|
|
|
|
|
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
|
|