1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251
|
#*
#* ------------------------------------------------------------------
#* Role PlayingDB V2.0 by Deepwoods Software
#* ------------------------------------------------------------------
#* RPGEdMonster.tcl - Monster Editor
#* Created by Robert Heller on Tue Aug 18 21:39:20 1998
#* ------------------------------------------------------------------
#* Modification History:
#* $Log: RPGEdMonster.tcl,v $
#* Revision 1.5 2000/02/11 00:30:25 heller
#* Change MacOS type code GIF => GIFf
#*
#* Revision 1.4 1999/07/13 01:29:16 heller
#* Fix documentation: spelling, punctuation, etc.
#*
#* Revision 1.3 1998/12/30 15:10:51 heller
#* Add in comments
#*
#* Revision 1.2 1998/12/28 01:41:55 heller
#* Add in chapter heading text.
#*
#* Revision 1.1 1998/12/28 01:29:06 heller
#* Initial revision
#*
#* ------------------------------------------------------------------
#* Contents:
#* ------------------------------------------------------------------
#*
#* Role Playing DB -- A database package that creates and maintains
#* a database of RPG characters, monsters, treasures,
#* spells, and playing environments.
#*
#* Copyright (C) 1995,1998 Robert Heller D/B/A Deepwoods Software
#* 51 Locke Hill Road
#* Wendell, MA 01379-9728
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 2 of the License, or
#* (at your option) any later version.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, write to the Free Software
#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#*
#*
#@Chapter:RPGEdMonster.tcl -- The adversaries in the game
#@Label:RPGEdMonster.tcl
#$Id: RPGEdMonster.tcl,v 1.5 2000/02/11 00:30:25 heller Rel $
# This file contains code to create and edit Monster objects. These objects
# are used to represent ``monsters'' -- creatures and beings that the players'
# characters need to defeat. These Monsters typically guard treasure or
# generally inhabit (guard) the places the player characters are traveling
# in while searching for treasure.
proc RPGEdMonster {{filename {}}} {
# This procedure edits a Monster object.
# <in> the filename -- filename of the object to be edited.
# [index] RPGEdMonster!procedure
global tk_version
set toplevel [GenerateToplevelName rpgEdMon]
RPGToplevel .$toplevel {Role Playing V2 Monster Editor} Monster
wm withdraw .$toplevel
global .$toplevel
upvar #0 .$toplevel data
set data(filename) "$filename"
set data(filetype) "monster"
if {[string length "$filename"] > 0} {
set data(object) [Monster]
set object $data(object)
if {[file readable "$filename"]} {
set buffer [Record]
if {[catch [list $buffer ReadRecord "$filename"] err]} {
CloseWindow .$toplevel
tkerror "Could not load $filename: $err"
return
}
if {[string compare {*Monster} "[lindex [$buffer ReturnRecord] 0]"] != 0} {
CloseWindow .$toplevel
tkerror "Not a Monster file: $filename"
return
}
$object UpdateFromRecord $buffer
rename $buffer {}
} else {
CloseWindow .$toplevel
tkerror "File does not exist or is not readable: $filename"
return
}
} else {
set data(object) [Monster]
set object $data(object)
set data(dirty) 0
}
# Construct a toplevel to display the monster's picture
toplevel .$toplevel.picture
wm transient .$toplevel.picture .$toplevel
wm title .$toplevel.picture {Picture of Monster}
wm protocol .$toplevel.picture WM_DELETE_WINDOW {NoOperation}
label .$toplevel.picture.imname -text "[$object Image]" -relief sunken -border 2
image create photo im$toplevel
# puts stderr "*** \[image names\] = [image names] - 'im$toplevel'"
label .$toplevel.picture.picture -image im$toplevel -relief ridge -border 2
bind .$toplevel.picture <Destroy> [list catch "image delete im$toplevel"]
pack .$toplevel.picture.imname -expand 1 -fill x
pack .$toplevel.picture.picture -expand 1 -fill both
set im "[$object Image]"
if {[string length "$im"] > 0} {
if {[catch [list im$toplevel configure -format gif -file "$im"] err]} {
tkerror "Could not set image file $im for image im$toplevel: $err"
}
}
set data(image) "$im"
# build widget .$toplevel.stringParams
frame .$toplevel.stringParams \
-borderwidth {2} \
-relief {ridge}
# build widget .$toplevel.stringParams.left
frame .$toplevel.stringParams.left
# build widget .$toplevel.stringParams.left.name
frame .$toplevel.stringParams.left.name
# build widget .$toplevel.stringParams.left.name.label14
label .$toplevel.stringParams.left.name.label14 \
-text {Name / Type:}
# build widget .$toplevel.stringParams.left.name.value
entry .$toplevel.stringParams.left.name.value \
-width {0} \
-textvariable ".[set toplevel](name)"
bind .$toplevel.stringParams.left.name.value <KeyPress> \
"SetDirty .$toplevel"
# build widget .$toplevel.stringParams.left.alignment
frame .$toplevel.stringParams.left.alignment \
-relief {raised}
# build widget .$toplevel.stringParams.left.alignment.label14
label .$toplevel.stringParams.left.alignment.label14 \
-text {Alignment:}
# build widget .$toplevel.stringParams.left.alignment.value
entry .$toplevel.stringParams.left.alignment.value \
-width {0} \
-textvariable ".[set toplevel](alignment)"
bind .$toplevel.stringParams.left.alignment.value <KeyPress> \
"SetDirty .$toplevel"
# build widget .$toplevel.stringParams.left.treasureType
frame .$toplevel.stringParams.left.treasureType
# build widget .$toplevel.stringParams.left.treasureType.label14
label .$toplevel.stringParams.left.treasureType.label14 \
-text {Treas. Type:}
# build widget .$toplevel.stringParams.left.treasureType.value
entry .$toplevel.stringParams.left.treasureType.value \
-width {0} \
-textvariable ".[set toplevel](treasureType)"
bind .$toplevel.stringParams.left.treasureType.value <KeyPress> \
"SetDirty .$toplevel"
# build widget .$toplevel.stringParams.right
frame .$toplevel.stringParams.right
# build widget .$toplevel.stringParams.right.specialAttacks
frame .$toplevel.stringParams.right.specialAttacks
# build widget .$toplevel.stringParams.right.specialAttacks.label14
label .$toplevel.stringParams.right.specialAttacks.label14 \
-text {Spec. Attacks:}
# build widget .$toplevel.stringParams.right.specialAttacks.value
entry .$toplevel.stringParams.right.specialAttacks.value \
-width {0} \
-textvariable ".[set toplevel](specialAttacks)"
bind .$toplevel.stringParams.right.specialAttacks.value <KeyPress> \
"SetDirty .$toplevel"
# build widget .$toplevel.stringParams.right.specialDefences
frame .$toplevel.stringParams.right.specialDefences
# build widget .$toplevel.stringParams.right.specialDefences.label14
label .$toplevel.stringParams.right.specialDefences.label14 \
-text {Spec. Defenses:}
# build widget .$toplevel.stringParams.right.specialDefences.value
entry .$toplevel.stringParams.right.specialDefences.value \
-width {0} \
-textvariable ".[set toplevel](specialDefences)"
bind .$toplevel.stringParams.right.specialDefences.value <KeyPress> \
"SetDirty .$toplevel"
# build widget .$toplevel.stringParams.right.psionics
frame .$toplevel.stringParams.right.psionics
# build widget .$toplevel.stringParams.right.psionics.label14
label .$toplevel.stringParams.right.psionics.label14 \
-text {Psionics:}
# build widget .$toplevel.stringParams.right.psionics.value
entry .$toplevel.stringParams.right.psionics.value \
-width {0} \
-textvariable ".[set toplevel](psionics)"
bind .$toplevel.stringParams.right.psionics.value <KeyPress> \
"SetDirty .$toplevel"
# build widget .$toplevel.hpParams
frame .$toplevel.hpParams \
-borderwidth {2} \
-relief {ridge}
# build widget .$toplevel.hpParams.hp
frame .$toplevel.hpParams.hp
# build widget .$toplevel.hpParams.hp.radiobutton16
radiobutton .$toplevel.hpParams.hp.radiobutton16 \
-text {Hit Points} \
-value {Monster::Points} \
-variable ".[set toplevel](HitType)" \
-command "SetDirty .$toplevel"
# build widget .$toplevel.hpParams.hp.hitpoints
entry .$toplevel.hpParams.hp.hitpoints \
-width {0} \
-textvariable ".[set toplevel](hitpoints)"
bind .$toplevel.hpParams.hp.hitpoints <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.hpParams.hp.hitpoints \
[list .$toplevel.hpParams.hp.hitpoints Entry .$toplevel all IntEntry]
# build widget .$toplevel.hpParams.hdice
frame .$toplevel.hpParams.hdice
# build widget .$toplevel.hpParams.hdice.radiobutton16
radiobutton .$toplevel.hpParams.hdice.radiobutton16 \
-text {Hit Dice} \
-value {Monster::Dice} \
-variable ".[set toplevel](HitType)" \
-command "SetDirty .$toplevel"
# build widget .$toplevel.hpParams.hdice.ndie
entry .$toplevel.hpParams.hdice.ndie \
-width {1} \
-textvariable ".[set toplevel](ndie)"
bind .$toplevel.hpParams.hdice.ndie <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.hpParams.hdice.ndie \
[list .$toplevel.hpParams.hdice.ndie Entry .$toplevel all IntEntry]
# build widget .$toplevel.hpParams.hdice.label19
label .$toplevel.hpParams.hdice.label19 \
-text {d}
# build widget .$toplevel.hpParams.hdice.hdie
entry .$toplevel.hpParams.hdice.hdie \
-width {1} \
-textvariable ".[set toplevel](hdie)"
bind .$toplevel.hpParams.hdice.hdie <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.hpParams.hdice.hdie \
[list .$toplevel.hpParams.hdice.hdie Entry .$toplevel all IntEntry]
# build widget .$toplevel.hpParams.hdice.label21
label .$toplevel.hpParams.hdice.label21 \
-text {+}
# build widget .$toplevel.hpParams.hdice.hplus
entry .$toplevel.hpParams.hdice.hplus \
-width {0} \
-textvariable ".[set toplevel](hplus)"
bind .$toplevel.hpParams.hdice.hplus <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.hpParams.hdice.hplus \
[list .$toplevel.hpParams.hdice.hplus Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams
frame .$toplevel.intParams \
-borderwidth {2} \
-relief {ridge}
# build widget .$toplevel.intParams.left
frame .$toplevel.intParams.left
# build widget .$toplevel.intParams.left.ac
frame .$toplevel.intParams.left.ac
# build widget .$toplevel.intParams.left.ac.label14
label .$toplevel.intParams.left.ac.label14 \
-text {Armor Class:}
# build widget .$toplevel.intParams.left.ac.value
entry .$toplevel.intParams.left.ac.value \
-width {0} \
-textvariable ".[set toplevel](ac)"
bind .$toplevel.intParams.left.ac.value <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.left.ac.value \
[list .$toplevel.intParams.left.ac.value Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.left.lair
frame .$toplevel.intParams.left.lair
# build widget .$toplevel.intParams.left.lair.label14
label .$toplevel.intParams.left.lair.label14 \
-text {Percent in Lair:}
# build widget .$toplevel.intParams.left.lair.value
entry .$toplevel.intParams.left.lair.value \
-width {0} \
-textvariable ".[set toplevel](lair)"
bind .$toplevel.intParams.left.lair.value <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.left.lair.value \
[list .$toplevel.intParams.left.lair.value Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.left.nAtt
frame .$toplevel.intParams.left.nAtt
# build widget .$toplevel.intParams.left.nAtt.label14
label .$toplevel.intParams.left.nAtt.label14 \
-text {Num. of Attacks:}
# build widget .$toplevel.intParams.left.nAtt.value
entry .$toplevel.intParams.left.nAtt.value \
-width {0} \
-textvariable ".[set toplevel](nAtt)"
bind .$toplevel.intParams.left.nAtt.value <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.left.nAtt.value \
[list .$toplevel.intParams.left.nAtt.value Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.left.magRes
frame .$toplevel.intParams.left.magRes
# build widget .$toplevel.intParams.left.magRes.label14
label .$toplevel.intParams.left.magRes.label14 \
-text {Magical Res.:}
# build widget .$toplevel.intParams.left.magRes.value
entry .$toplevel.intParams.left.magRes.value \
-width {0} \
-textvariable ".[set toplevel](magRes)"
bind .$toplevel.intParams.left.magRes.value <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.left.magRes.value \
[list .$toplevel.intParams.left.magRes.value Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right
frame .$toplevel.intParams.right
# build widget .$toplevel.intParams.right.move
frame .$toplevel.intParams.right.move
# build widget .$toplevel.intParams.right.move.label14
label .$toplevel.intParams.right.move.label14 \
-text {Move:}
# build widget .$toplevel.intParams.right.move.m
entry .$toplevel.intParams.right.move.m \
-width {2} \
-textvariable ".[set toplevel](move)"
bind .$toplevel.intParams.right.move.m <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.move.m \
[list .$toplevel.intParams.right.move.m Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.move.label35
label .$toplevel.intParams.right.move.label35 \
-text {"/}
# build widget .$toplevel.intParams.right.move.f
entry .$toplevel.intParams.right.move.f \
-width {2} \
-textvariable ".[set toplevel](fly)"
bind .$toplevel.intParams.right.move.f <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.move.f \
[list .$toplevel.intParams.right.move.f Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.move.label37
label .$toplevel.intParams.right.move.label37 \
-text {"//}
# build widget .$toplevel.intParams.right.move.s
entry .$toplevel.intParams.right.move.s \
-width {2} \
-textvariable ".[set toplevel](swim)"
bind .$toplevel.intParams.right.move.s <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.move.s \
[list .$toplevel.intParams.right.move.s Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.move.label39
label .$toplevel.intParams.right.move.label39 \
-text {"(}
# build widget .$toplevel.intParams.right.move.b
entry .$toplevel.intParams.right.move.b \
-width {2} \
-textvariable ".[set toplevel](burrow)"
bind .$toplevel.intParams.right.move.b <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.move.b \
[list .$toplevel.intParams.right.move.b Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.move.label41
label .$toplevel.intParams.right.move.label41 \
-text {")*}
# build widget .$toplevel.intParams.right.move.w
entry .$toplevel.intParams.right.move.w \
-width {2} \
-textvariable ".[set toplevel](web)"
bind .$toplevel.intParams.right.move.w <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.move.w \
[list .$toplevel.intParams.right.move.w Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.move.label43
label .$toplevel.intParams.right.move.label43 \
-text {"}
# build widget .$toplevel.intParams.right.damAtt
frame .$toplevel.intParams.right.damAtt
# build widget .$toplevel.intParams.right.damAtt.label14
label .$toplevel.intParams.right.damAtt.label14 \
-text {Damage/Attack:}
# build widget .$toplevel.intParams.right.damAtt.min
entry .$toplevel.intParams.right.damAtt.min \
-width {0} \
-textvariable ".[set toplevel](damAtt.min)"
bind .$toplevel.intParams.right.damAtt.min <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.damAtt.min \
[list .$toplevel.intParams.right.damAtt.min Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.damAtt.label45
label .$toplevel.intParams.right.damAtt.label45 \
-text {to}
# build widget .$toplevel.intParams.right.damAtt.max
entry .$toplevel.intParams.right.damAtt.max \
-width {0} \
-textvariable ".[set toplevel](damAtt.max)"
bind .$toplevel.intParams.right.damAtt.max <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.damAtt.max \
[list .$toplevel.intParams.right.damAtt.max Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.numApear
frame .$toplevel.intParams.right.numApear \
-borderwidth {1}
# build widget .$toplevel.intParams.right.numApear.label14
label .$toplevel.intParams.right.numApear.label14 \
-text {Number Appearing:}
# build widget .$toplevel.intParams.right.numApear.min
entry .$toplevel.intParams.right.numApear.min \
-width {0} \
-textvariable ".[set toplevel](numApear.min)"
bind .$toplevel.intParams.right.numApear.min <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.numApear.min \
[list .$toplevel.intParams.right.numApear.min Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.numApear.label45
label .$toplevel.intParams.right.numApear.label45 \
-text {to}
# build widget .$toplevel.intParams.right.numApear.max
entry .$toplevel.intParams.right.numApear.max \
-width {0} \
-textvariable ".[set toplevel](numApear.max)"
bind .$toplevel.intParams.right.numApear.max <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.numApear.max \
[list .$toplevel.intParams.right.numApear.max Entry .$toplevel all IntEntry]
# build widget .$toplevel.intParams.right.size
frame .$toplevel.intParams.right.size
# build widget .$toplevel.intParams.right.size.label14
label .$toplevel.intParams.right.size.label14 \
-text {Size:}
# build widget .$toplevel.intParams.right.size.value
entry .$toplevel.intParams.right.size.value \
-width {0} \
-textvariable ".[set toplevel](size)"
bind .$toplevel.intParams.right.size.value <KeyPress> \
"SetDirty .$toplevel"
bindtags .$toplevel.intParams.right.size.value \
[list .$toplevel.intParams.right.size.value Entry .$toplevel all FloatEntry]
# build widget .$toplevel.ifs
frame .$toplevel.ifs \
-borderwidth {2} \
-relief {ridge}
# build widget .$toplevel.ifs.intel
tk_optionMenu .$toplevel.ifs.intel .[set toplevel](intelligence) \
Non Animal Semi Low Average Very Highly Exceptionally Genius SupraGenius Godlike
# build widget .$toplevel.ifs.freq
tk_optionMenu .$toplevel.ifs.freq .[set toplevel](frequency) \
Unique VeryRare Rare Uncommon Common
# build widget .$toplevel.description
frame .$toplevel.description \
-borderwidth {2} \
-relief {ridge}
# build widget .$toplevel.description.scrollbar1
scrollbar .$toplevel.description.scrollbar1 \
-command ".$toplevel.description.value yview" \
-relief {raised}
# build widget .$toplevel.description.value
text .$toplevel.description.value \
-height {2} \
-width {60} \
-wrap {word} \
-yscrollcommand ".$toplevel.description.scrollbar1 set"
bindtags .$toplevel.description.value \
[list .$toplevel.description.value Text .$toplevel all UpdComments]
# build widget .$toplevel.buttons
frame .$toplevel.buttons \
-borderwidth {2}
# build widget .$toplevel.buttons.button49
button .$toplevel.buttons.button49 \
-command "LoadMonster .$toplevel" \
-text {Load}
# build widget .$toplevel.buttons.button50
button .$toplevel.buttons.button50 \
-command "SaveMonster .$toplevel" \
-text {Save}
# build widget .$toplevel.buttons.button51
button .$toplevel.buttons.button51 \
-text {Change Picture} \
-command "UpdateMonsterPicture .$toplevel im$toplevel"
# pack master .$toplevel.stringParams
pack configure .$toplevel.stringParams.left \
-expand 1 \
-fill both \
-side left
pack configure .$toplevel.stringParams.right \
-expand 1 \
-fill both \
-side right
# pack master .$toplevel.stringParams.left
pack configure .$toplevel.stringParams.left.name \
-expand 1 \
-fill x
pack configure .$toplevel.stringParams.left.alignment \
-expand 1 \
-fill x
pack configure .$toplevel.stringParams.left.treasureType \
-expand 1 \
-fill x
# pack master .$toplevel.stringParams.left.name
pack configure .$toplevel.stringParams.left.name.label14 \
-side left
pack configure .$toplevel.stringParams.left.name.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.stringParams.left.alignment
pack configure .$toplevel.stringParams.left.alignment.label14 \
-side left
pack configure .$toplevel.stringParams.left.alignment.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.stringParams.left.treasureType
pack configure .$toplevel.stringParams.left.treasureType.label14 \
-side left
pack configure .$toplevel.stringParams.left.treasureType.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.stringParams.right
pack configure .$toplevel.stringParams.right.specialAttacks \
-expand 1 \
-fill x
pack configure .$toplevel.stringParams.right.specialDefences \
-expand 1 \
-fill x
pack configure .$toplevel.stringParams.right.psionics \
-expand 1 \
-fill x
# pack master .$toplevel.stringParams.right.specialAttacks
pack configure .$toplevel.stringParams.right.specialAttacks.label14 \
-side left
pack configure .$toplevel.stringParams.right.specialAttacks.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.stringParams.right.specialDefences
pack configure .$toplevel.stringParams.right.specialDefences.label14 \
-side left
pack configure .$toplevel.stringParams.right.specialDefences.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.stringParams.right.psionics
pack configure .$toplevel.stringParams.right.psionics.label14 \
-side left
pack configure .$toplevel.stringParams.right.psionics.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.hpParams
pack configure .$toplevel.hpParams.hp \
-expand 1 \
-fill both \
-side left
pack configure .$toplevel.hpParams.hdice \
-expand 1 \
-fill both \
-side right
# pack master .$toplevel.hpParams.hp
pack configure .$toplevel.hpParams.hp.radiobutton16 \
-side left
pack configure .$toplevel.hpParams.hp.hitpoints \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.hpParams.hdice
pack configure .$toplevel.hpParams.hdice.radiobutton16 \
-side left
pack configure .$toplevel.hpParams.hdice.ndie \
-side left
pack configure .$toplevel.hpParams.hdice.label19 \
-side left
pack configure .$toplevel.hpParams.hdice.hdie \
-side left
pack configure .$toplevel.hpParams.hdice.label21 \
-side left
pack configure .$toplevel.hpParams.hdice.hplus \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.intParams
pack configure .$toplevel.intParams.left \
-expand 1 \
-fill both \
-side left
pack configure .$toplevel.intParams.right \
-expand 1 \
-fill both \
-side right
# pack master .$toplevel.intParams.left
pack configure .$toplevel.intParams.left.ac \
-expand 1 \
-fill x
pack configure .$toplevel.intParams.left.lair \
-expand 1 \
-fill x
pack configure .$toplevel.intParams.left.nAtt \
-expand 1 \
-fill x
pack configure .$toplevel.intParams.left.magRes \
-expand 1 \
-fill x
# pack master .$toplevel.intParams.left.ac
pack configure .$toplevel.intParams.left.ac.label14 \
-side left
pack configure .$toplevel.intParams.left.ac.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.intParams.left.lair
pack configure .$toplevel.intParams.left.lair.label14 \
-side left
pack configure .$toplevel.intParams.left.lair.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.intParams.left.nAtt
pack configure .$toplevel.intParams.left.nAtt.label14 \
-side left
pack configure .$toplevel.intParams.left.nAtt.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.intParams.left.magRes
pack configure .$toplevel.intParams.left.magRes.label14 \
-side left
pack configure .$toplevel.intParams.left.magRes.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.intParams.right
pack configure .$toplevel.intParams.right.move \
-expand 1 \
-fill x
pack configure .$toplevel.intParams.right.damAtt \
-expand 1 \
-fill x
pack configure .$toplevel.intParams.right.numApear \
-expand 1 \
-fill x
pack configure .$toplevel.intParams.right.size \
-expand 1 \
-fill x
# pack master .$toplevel.intParams.right.move
pack configure .$toplevel.intParams.right.move.label14 \
-side left
pack configure .$toplevel.intParams.right.move.m \
-expand 1 \
-fill x \
-side left
pack configure .$toplevel.intParams.right.move.label35 \
-side left
pack configure .$toplevel.intParams.right.move.f \
-expand 1 \
-fill x \
-side left
pack configure .$toplevel.intParams.right.move.label37 \
-side left
pack configure .$toplevel.intParams.right.move.s \
-expand 1 \
-fill x \
-side left
pack configure .$toplevel.intParams.right.move.label39 \
-side left
pack configure .$toplevel.intParams.right.move.b \
-expand 1 \
-fill x \
-side left
pack configure .$toplevel.intParams.right.move.label41 \
-side left
pack configure .$toplevel.intParams.right.move.w \
-expand 1 \
-fill x \
-side left
pack configure .$toplevel.intParams.right.move.label43 \
-side left
# pack master .$toplevel.intParams.right.damAtt
pack configure .$toplevel.intParams.right.damAtt.label14 \
-side left
pack configure .$toplevel.intParams.right.damAtt.min \
-expand 1 \
-fill x \
-side left
pack configure .$toplevel.intParams.right.damAtt.label45 \
-side left
pack configure .$toplevel.intParams.right.damAtt.max \
-expand 1 \
-fill x \
-side left
# pack master .$toplevel.intParams.right.numApear
pack configure .$toplevel.intParams.right.numApear.label14 \
-side left
pack configure .$toplevel.intParams.right.numApear.min \
-expand 1 \
-fill x \
-side left
pack configure .$toplevel.intParams.right.numApear.label45 \
-side left
pack configure .$toplevel.intParams.right.numApear.max \
-expand 1 \
-fill x \
-side left
# pack master .$toplevel.intParams.right.size
pack configure .$toplevel.intParams.right.size.label14 \
-side left
pack configure .$toplevel.intParams.right.size.value \
-expand 1 \
-fill x \
-side right
# pack master .$toplevel.ifs
pack configure .$toplevel.ifs.intel -side left -expand 1 -fill x
pack configure .$toplevel.ifs.freq -side right -expand 1 -fill x
# pack master .$toplevel.description
pack configure .$toplevel.description.scrollbar1 \
-fill y \
-side right
pack configure .$toplevel.description.value \
-expand 1 \
-fill both
# pack master .$toplevel.buttons
pack configure .$toplevel.buttons.button49 \
-expand 1 \
-side left
pack configure .$toplevel.buttons.button50 \
-expand 1 \
-side left
pack configure .$toplevel.buttons.button51 \
-expand 1 \
-side left
# pack master .$toplevel
pack configure .$toplevel.stringParams \
-expand 1 \
-fill x
pack configure .$toplevel.hpParams \
-expand 1 \
-fill x
pack configure .$toplevel.intParams \
-expand 1 \
-fill x
pack configure .$toplevel.ifs \
-expand 1 \
-fill x
pack configure .$toplevel.description \
-expand 1 \
-fill both
pack configure .$toplevel.buttons \
-expand 1 \
-fill x
set data(name) "[$object Name]"
set data(alignment) "[$object Alignment]"
set data(treasureType) "[$object TreasureType]"
set data(specialAttacks) "[$object SpecialAttacks]"
set data(specialDefences) "[$object SpecialDefences]"
set data(psionics) "[$object Psionics]"
set data(HitType) [$object Hittype]
set data(hitpoints) [$object HitPoints]
set data(ndie) [$object NumHitDice]
set data(hdie) [$object HitDieSides]
set data(hplus) [$object HitAdjustment]
set data(ac) [$object ArmorClass]
set data(lair) [$object PercentInLair]
set data(nAtt) [$object NumberOfAttacks]
set data(magRes) [$object MagicalResistance]
set data(move) [$object LandSpeed]
set data(fly) [$object FlyingSpeed]
set data(swim) [$object SwimmingSpeed]
set data(burrow) [$object BurrowingSpeed]
set data(web) [$object WebSpeed]
set damAtt [$object DamagePerAttack]
set data(damAtt.min) [lindex $damAtt 0]
set data(damAtt.max) [lindex $damAtt 1]
set numApear [$object NumberAppearing]
set data(numApear.min) [lindex $numApear 0]
set data(numApear.max) [lindex $numApear 1]
set data(size) [$object Size]
set data(comments) [$object Comments]
.$toplevel.description.value insert end "$data(comments)"
set intel [$object Intelligence]
regsub -all {^Monster::} "$intel" {} data(intelligence)
set freq [$object Frequency]
regsub -all {^Monster::} "$freq" {} data(frequency)
rename $object {}
# end of widget tree
wm deiconify .$toplevel
}
proc UpdateMonsterPicture {tl img} {
# This procedure updates the picture (GIF file) of the monster.
# <in> tl -- the toplevel.
# <in> img -- the image file.
# [index] UpdateMonsterPicture!procedure
upvar #0 $tl data
set initdir "[file dirname $data(image)]"
if {[string compare "$initdir" {.}] == 0} {set initdir "[pwd]"}
if {[string compare "[string index "$initdir" 0]" {/}] != 0} {
set initdir [file join "[pwd]" "$initdir"]
}
set newIm [tk_getOpenFile -defaultextension {.gif} \
-filetypes { { {GIF Files} {*.gif *.GIF} GIFf } } \
-initialfile "$data(image)" \
-initialdir "$initdir" \
-parent "$tl" \
-title {Select a new image file}]
if {[string length "$newIm"] == 0} {return}
if {[catch [list $img configure -format gif -file "$newIm"] err]} {
tkerror "Could not set image file $newIm for image $img: $err"
}
$tl.picture.imname configure -text "$newIm"
set data(image) "$newIm"
set data(dirty) 1
}
proc CheckWriteDirtyRecordMonster {tl} {
# This procedure handles closing the window when the in memory copy of the
# object is ``dirty'' (modified). It asks the user if the object should be
# saved or not.
# <in> tl -- the toplevel.
# [index] CheckWriteDirtyRecordMonster!procedure
upvar #0 $tl data
set filename "$data(filename)"
set filetype "$data(filetype)"
set saveP [tk_dialog .askDirty "Save monster?" "Save modified Monster data?" \
questhead 0 "Yes" "No"]
if {$saveP == 0} {
switch -exact $data(HitType) {
Monster::Points {
set object [Monster -this [NewMonster \
-image "$data(image)" \
-name "$data(name)" \
-alignment "$data(alignment)" \
-treasure "$data(treasureType)" \
-specialatt "$data(specialAttacks)" \
-specialdef "$data(specialDefences)" \
-psionics "$data(psionics)" \
-armorclass $data(ac) \
-landspeed $data(move) \
-flyingspeed $data(fly) \
-swimmingspeed $data(swim) \
-burrowingspeed $data(burrow) \
-webspeed $data(web) \
-percentlair $data(lair) \
-numattacks $data(nAtt) \
-mindamage $data(damAtt.min) \
-maxdamage $data(damAtt.max) \
-magicres $data(magRes) \
-minnumappear $data(numApear.min) \
-maxnumappear $data(numApear.max) \
-intelligence Monster::$data(intelligence) \
-frequency Monster::$data(frequency) \
-size $data(size) \
-comments "$data(comments)" \
-hitpoints $data(hitpoints) \
-hittype $data(HitType)]]
}
Monster::Dice {
set object [Monster -this [NewMonster \
-image "$data(image)" \
-name "$data(name)" \
-alignment "$data(alignment)" \
-treasure "$data(treasureType)" \
-specialatt "$data(specialAttacks)" \
-specialdef "$data(specialDefences)" \
-psionics "$data(psionics)" \
-armorclass $data(ac) \
-landspeed $data(move) \
-flyingspeed $data(fly) \
-swimmingspeed $data(swim) \
-burrowingspeed $data(burrow) \
-webspeed $data(web) \
-percentlair $data(lair) \
-numattacks $data(nAtt) \
-mindamage $data(damAtt.min) \
-maxdamage $data(damAtt.max) \
-magicres $data(magRes) \
-minnumappear $data(numApear.min) \
-maxnumappear $data(numApear.max) \
-intelligence Monster::$data(intelligence) \
-frequency Monster::$data(frequency) \
-size $data(size) \
-comments "$data(comments)" \
-hitdie $data(hdie) \
-numhitdice $data(ndie) \
-hitadjust $data(hplus) \
-hittype $data(HitType)]]
}
}
set buffer [Record -this [$object RawData]]
if {[string length "$filename"] == 0} {
set filename [tk_getSaveFile -defaultextension ".$filetype" \
-initialfile "new.$filetype" \
-initialdir "[pwd]" \
-filetypes [list [list "Monster files" \
"*.$filetype"]]\
-parent . \
-title {File to save monster data in}]
if {[string length "$filename"] == 0} {return}
if {[string length "[file extension $filename]"] == 0} {
set filename "$filename.$filetype"
}
}
$buffer WriteRecord "$filename"
rename $buffer {}
rename $object {}
}
}
proc SaveAsMonster {tl} {
# This procedure is bound to the ``SaveAs...'' menu item. It saves the current
# object in a file to be named.
# <in> tl -- the toplevel.
# [index] SaveAsMonster!procedure
SaveMonster $tl 1
}
proc SaveMonster {tl {forceNew 0}} {
# This procedure is bound to the ``Save'' menu item. It saves the current
# object in the file named in the data structure or in a new file name.
# <in> tl -- the toplevel.
# <in> forceNew -- flag to force the use of a new file name.
# [index] SaveAsMonster!procedure
upvar #0 $tl data
set filename "$data(filename)"
set filetype "$data(filetype)"
switch -exact $data(HitType) {
Monster::Points {
set object [Monster -this [NewMonster \
-image "$data(image)" \
-name "$data(name)" \
-alignment "$data(alignment)" \
-treasure "$data(treasureType)" \
-specialatt "$data(specialAttacks)" \
-specialdef "$data(specialDefences)" \
-psionics "$data(psionics)" \
-armorclass $data(ac) \
-landspeed $data(move) \
-flyingspeed $data(fly) \
-swimmingspeed $data(swim) \
-burrowingspeed $data(burrow) \
-webspeed $data(web) \
-percentlair $data(lair) \
-numattacks $data(nAtt) \
-mindamage $data(damAtt.min) \
-maxdamage $data(damAtt.max) \
-magicres $data(magRes) \
-minnumappear $data(numApear.min) \
-maxnumappear $data(numApear.max) \
-intelligence Monster::$data(intelligence) \
-frequency Monster::$data(frequency) \
-size $data(size) \
-commentary "$data(comments)" \
-hitpoints $data(hitpoints) \
-hittype $data(HitType)]]
}
Monster::Dice {
set object [Monster -this [NewMonster \
-image "$data(image)" \
-name "$data(name)" \
-alignment "$data(alignment)" \
-treasure "$data(treasureType)" \
-specialatt "$data(specialAttacks)" \
-specialdef "$data(specialDefences)" \
-psionics "$data(psionics)" \
-armorclass $data(ac) \
-landspeed $data(move) \
-flyingspeed $data(fly) \
-swimmingspeed $data(swim) \
-burrowingspeed $data(burrow) \
-webspeed $data(web) \
-percentlair $data(lair) \
-numattacks $data(nAtt) \
-mindamage $data(damAtt.min) \
-maxdamage $data(damAtt.max) \
-magicres $data(magRes) \
-minnumappear $data(numApear.min) \
-maxnumappear $data(numApear.max) \
-intelligence Monster::$data(intelligence) \
-frequency Monster::$data(frequency) \
-size $data(size) \
-commentary "$data(comments)" \
-hitdie $data(hdie) \
-numhitdice $data(ndie) \
-hitadjust $data(hplus) \
-hittype $data(HitType)]]
}
}
set buffer [Record -this [$object RawData]]
set initdir "[file dirname $filename]"
if {[string compare "$initdir" {.}] == 0} {set initdir "[pwd]"}
if {[string compare "[string index "$initdir" 0]" {/}] != 0} {
set initdir [file join "[pwd]" "$initdir"]
}
if {[string length "$filename"] == 0} {
set initfile "new.$filetype"
} else {
set initfile "$filename"
}
if {$forceNew || [string length "$filename"] == 0} {
set filename [tk_getSaveFile -defaultextension ".$filetype" \
-initialfile "$initfile" \
-initialdir "$initdir" \
-filetypes [list [list "Monster files" \
"*.$filetype"]]\
-parent $tl \
-title {File to save monster data in}]
if {[string length "$filename"] == 0} {return}
if {[string length "[file extension $filename]"] == 0} {
set filename "$filename.$filetype"
}
}
$buffer WriteRecord "$filename"
rename $buffer {}
rename $object {}
set data(dirty) 0
set data(filename) "$filename"
}
proc LoadMonster {tl} {
# This procedure loads a new monster object into the current GUI.
# <in> tl -- the toplevel.
# [index] LoadMonster!procedure
upvar #0 $tl data
set filename "$data(filename)"
set filetype "$data(filetype)"
if {$data(dirty)} {
set saveP [tk_dialog .askDirty "Save monster?" \
"Save modified Monster data?" \
questhead 0 "Yes" "No"]
if {$saveP == 0} {SaveMonster $tl}
}
set initdir "[file dirname $filename]"
if {[string compare "$initdir" {.}] == 0} {set initdir "[pwd]"}
if {[string compare "[string index "$initdir" 0]" {/}] != 0} {
set initdir [file join "[pwd]" "$initdir"]
}
set filename [tk_getOpenFile -defaultextension ".$filetype" \
-initialfile "$filename" \
-initialdir "$initdir" \
-filetypes [list [list "Monster files" \
"*.$filetype"]]\
-parent $tl \
-title {File to load monster data from}]
if {[string length "$filename"] == 0} {return}
set buffer [Record]
if {[catch [list $buffer ReadRecord "$filename"] err]} {
tkerror "Could not load file $filename: $err"
rename $buffer {}
return
}
set key [lindex [$buffer ReturnRecord] 0]
if {[string compare "$key" {*Monster}] != 0} {
rename $buffer {}
tkerror "Not a monster file: $filename"
return
}
set object [Monster]
$object UpdateFromRecord $buffer
rename $buffer {}
set data(name) "[$object Name]"
set data(alignment) "[$object Alignment]"
set data(treasureType) "[$object TreasureType]"
set data(specialAttacks) "[$object SpecialAttacks]"
set data(specialDefences) "[$object SpecialDefences]"
set data(psionics) "[$object Psionics]"
set data(HitType) [$object Hittype]
# puts stderr "*** LoadMonster: data(HitType) = $data(HitType)"
set data(hitpoints) [$object HitPoints]
set data(ndie) [$object NumHitDice]
set data(hdie) [$object HitDieSides]
set data(hplus) [$object HitAdjustment]
set data(ac) [$object ArmorClass]
set data(lair) [$object PercentInLair]
set data(nAtt) [$object NumberOfAttacks]
set data(magRes) [$object MagicalResistance]
set data(move) [$object LandSpeed]
set data(fly) [$object FlyingSpeed]
set data(swim) [$object SwimmingSpeed]
set data(burrow) [$object BurrowingSpeed]
set data(web) [$object WebSpeed]
set damAtt [$object DamagePerAttack]
set data(damAtt.min) [lindex $damAtt 0]
set data(damAtt.max) [lindex $damAtt 1]
set numApear [$object NumberAppearing]
set data(numApear.min) [lindex $numApear 0]
set data(numApear.max) [lindex $numApear 1]
set data(size) [$object Size]
set data(comments) [$object Comments]
$tl.description.value insert end "$data(comments)"
set intel [$object Intelligence]
regsub -all {^Monster::} "$intel" {} data(intelligence)
set freq [$object Frequency]
regsub -all {^Monster::} "$freq" {} data(frequency)
set data(image) "[$object Image]"
set imname [$tl.picture.picture cget -image]
if {[catch [list $imname configure -format gif -file "[$object Image]"] err]} {
tkerror "Could not set image file [$object Image] for image $imname: $err"
}
rename $object {}
}
proc OpenMonster {tl} {
# This procedure opens a monster object file in a new GUI toplevel window.
# It is bound to the ``Open...'' menu item on the ``File'' menu.
# <in> tl -- the current toplevel.
# [index] OpenMonster!procedure
if {"$tl" == {.}} {
set data(filename) {}
set data(filetype) monster
set data(class) Monster
} else {
upvar #0 $tl data
}
set filename "$data(filename)"
set filetype "$data(filetype)"
set initdir "[file dirname $filename]"
if {[string compare "$initdir" {.}] == 0} {set initdir "[pwd]"}
if {[string compare "[string index "$initdir" 0]" {/}] != 0} {
set initdir [file join "[pwd]" "$initdir"]
}
set filename [tk_getOpenFile -defaultextension ".$data(filetype)" \
-filetypes [list [list "$data(class) files" \
"*.$filetype"]]\
-parent $tl \
-initialfile "$filename" \
-initialdir "$initdir" \
-title "File to load $data(class) data from"]
if {[string length "$filename"] == 0} {return}
RPGEd$data(class) "$filename"
}
package provide RPGEdMonster 1.0
|