|
Danj Beginner
Joined: 12 Oct 2000 Posts: 17 Location: United Kingdom
|
Posted: Sun Apr 11, 2004 2:33 pm
#READ and _noexpand? |
Is there a way to use _noexpand with the filename-style syntax of #READ? I want to use it to import a script, but it seems to eat all the %1s. Looking at the help file it seems like this is intended, so that parameters can be used with #READ, but when I try and use _noexpand to disable this behaviour it doesn't work. For example,
Code: |
#READ C:wjs_speedwalk.zsc |
and
Code: |
#READ C:wjs_speedwalk.zsc _noexpand |
do exactly the same thing, and any %1s that might have been in the file are lost. If you need to have a look at the scripts in question, they're on my web page at http://www.jacko.demon.co.uk/aardwolf/
|
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Mon Apr 12, 2004 1:42 am |
That's because normally 'read filname' wont expand %1's and variables
used to create triggers, aliases etc. But in your case your whole script is inside an IF
statement and thats causing it to be parsed. So a workaround for your script is to do it like this.
#IF (%version < 705) {
#SHOW Zmud version not high enough! Can't Install
#ABORT 1
}
#SHOW {Installing Script!}
#CLASS blah/blah
#CLASS 0
Very nice scripts btw :)
Cheers, Jesse |
|
|
|
Danj Beginner
Joined: 12 Oct 2000 Posts: 17 Location: United Kingdom
|
Posted: Thu Apr 22, 2004 10:48 pm |
That didn't seem to work, I'm guessing that it might be because the affected code is inside an if statement as well?
Here's one of the affected bits of code, from the spellup module:
Code: |
#ALIAS wjs_addspell {
#CLASS wjs_core/spellup
#if (%-1 != "") {
wjs_spellup_name=%-1
} {
wjs_spellup_name=""
#IF (%numitems(@wjs_spellup_list) > 0) {
#CLASS wjs_core
wjs_temp=%pick("p:Current spellnames:", "o:1", @wjs_spellup_list)
}
#CLASS wjs_core/spellup
#prompt wjs_spellup_name "Enter the spell name"
}
#ADDITEM wjs_spellup_list @wjs_spellup_name
#ECHO Spell @wjs_spellup_name added successfully.
#CLASS 0
}
|
Both of the %-1s get eaten. |
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Thu Apr 22, 2004 11:38 pm |
I actually play on Aardwolf as well, and I converted 2 of your scripts already. They work perfectly now with #READ. What I was trying to say was Instead of doing #IF {check before install} {display cant install} {install code}
was to #IF {Check before Install} {display cant install;ABort}; Now install outside of the #IF. You must do this for all your #IFs that check whether or not the user has the correct requirements to install.
Here's how the beginning of your spellup script should look
#if (%version < 705) {
#ECHO "wjs_spellup_install: Either you have an old version of zMUD or you are"
#ECHO "not correctly installing this module."
#ABORT 1
//Can't Install we're aborting
}
#CLASS 0
#VAR wjs_spellup_thisversion 116
#IF (%ismember("spellup", @wjs_modules_installed) and @wjs_spellup_version >= @wjs_spellup_thisversion) {
#message "wjs_spellup_install: You already have the same or a newer version of this module installed."
#ABORT 1
//Can't Install we're aborting
}
#IF (!%ismember("core", @wjs_modules_installed)) {
#message "wjs_spellup_install: You must install the core module of Wacko Jacko's Script system before you can install this module."
#ABORT 1
//Can't Install we're aborting
}
//Now WE CAN INSTALL --- And none of your script is inside an if statement anymore.
#ECHO {wjs_spellup_install: Now installing module "spellup", version %format(2,[%float(@wjs_spellup_thisversion)/%float(100)])}
#CLASS wjs_core/spellup
#VAR wjs_spellup_name ""
#VAR wjs_spellup_temp ""
#ALIAS wjs_addspell {
#CLASS wjs_core/spellup
#if (%-1 != "") {
wjs_spellup_name=%-1
} {
wjs_spellup_name=""
#IF (%numitems(@wjs_spellup_list) > 0) {
#CLASS wjs_core
wjs_temp=%pick("p:Current spellnames:", "o:1", @wjs_spellup_list)
}
#CLASS wjs_core/spellup
#prompt wjs_spellup_name "Enter the spell name"
}
#ADDITEM wjs_spellup_list @wjs_spellup_name
#ECHO Spell @wjs_spellup_name added successfully.
#CLASS 0
}
//CUT THE REST OF SCRIPT---
Cheers, Jesse |
|
|
|
Danj Beginner
Joined: 12 Oct 2000 Posts: 17 Location: United Kingdom
|
Posted: Sat Apr 24, 2004 6:35 pm |
Thanks a lot! I tried that and it worked great - I guess I should have realised that it applies to all three #IF statements, not just the first one.
|
|
|
|
|
|