![](templates/Classic/images/spacer.gif) |
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Tue Feb 18, 2003 4:21 pm
I need help converting this script for gemstone |
Here's a script for the wizard FE that is pretty representative of most scripts I use. If you can show me how to do this with zmud, I'm pretty sure I'll have a really good grasp on how to make my own (and show other people how, too).
The usage of this is .skin <dead creature(%1)> <skin type, skin, pelt, etc. (%2)>
With the FE you put a period before the script name to run it.
I added some comments to describe whats going on, but its mostly pretty self explanatory. Thanks alot in advance :)
check_1:
if_1 goto check_hands //this means if there is a %1, goto the label check_hands
echo What do you want to skin? //else, echo something and then exit
exit
check_hands:
match longsword longsword in your right hand //sets up a trigger for 'Longsword in your right hand' and when it is triggered it goes to the label longsword
match waraxe waraxe in your right hand
match handaxe handaxe in your right hand
match get_knife You glance down to see
put glance //put = send to mud. Glance tells you what you are holding in your hands.
matchwait //basicaly stops the script here, it can only advance if one of the matches are matched.
longsword:
setvariable weapon_temp longsword //setvariable <variable name> <value>
put put my longsword in my %sheath
goto get_knife
waraxe:
setvariable weapon_temp waraxe
put put my waraxe in my %sheath
goto get_knife
handaxe:
setvariable weapon_temp handaxe
put put my handaxe in my %sheath
goto get_knife
get_knife:
match skin You remove
match error I could not find what you were referring to.
put get %skinning_knife from my %skinning_knife_holder
matchwait
skin:
match success You skinned
match fail You botched the job.
match fail You can only skin creatures!
put kneel
put skin %1 //skins the <creature>
matchwait
success:
counter set %skin_success //the counter (%c) variable is a special variable and the only one you can do math on. This sets the counter to what the %skin_success variable is.
counter add //and then increments it
setvariable skin_success %c //and then saves it back to the skin_success variable
save success //saves the string 'success' to the temporary variable %s
goto stand
fail:
counter set %skin_fail
counter add
setvariable skin_fail %c
save fail
goto stand
stand:
match stand_ok You are already
match stand_ok You stand back up.
match stand_again You struggle
put stand
matchwait
stand_again:
pause
goto stand
stand_ok:
goto cleanup
cleanup:
put put my %skinning_knife in my %skinning_knife_holder
waitfor You put
if_2 goto %s%_finish
goto fail_finish
success_finish:
put get %2
put open my %loot_container
put put my %2 in my %loot_container
waitfor Ok, it opened. //waitfor pauses the script untill it it matches the text following it
waitfor You put
put close my %loot_container
put search %1
put get my %weapon_temp
deletevariable weapon_temp
exit
fail_finish:
put search %1
put get my %weapon_temp
deletevariable weapon_temp
exit
error:
echo ** Skinning knife could not be found! **
exit
-Stregone |
|
|
![](templates/Classic/images/spacer.gif) |
Vijilante SubAdmin
![](images/avatars/7230815434153eca6be3ad.gif)
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Feb 19, 2003 12:46 am |
I did a quick job writing this up, I havent tested it thoroughly, but I am quite certain it is working. I could have follow the wizard FE format a little more closely, but I wanted to show you some of the different styles that are possible. The final potion of the script in "SkinStand" trigger is the one designed to most closely resemble the wizard format. There are probably another 20 styles I could have used, but I managed to get the most common and concise methods acrossed. I recommend that you look up everything in the help files.
The biggest difference that you will note from the wizard language to zScript is that there is no GOTO in zScript. Structured language definitions starting back at the first rendition of Pascal over 30 years ago decided that GOTO should never be needed, all languages based on BASIC however keep the goto. Personally since I have done programming in many scripting languages, C Pascal, BASIC, and Assembly on many different machines I appreciate having a GOTO, but recognize the havok it plays in stack and memory control, so I would say no scripting language of any power should ever have it.
All that aside, I was unsure of what "pause" did in the wizard language so I designed a pause, it is only for 1 second though. You can find and adjust it if need be. I also built in a little failure item incase you don't have a weapon in hand. I think it would be rediculous to have the whole script waiting there because of user error. This in fact was an error in your original script, if the skining knife was not found no attempt would be made to get your original weapon.
#CLASS {Skinning}
#ALIAS skin {#IF (%numparam<1) {#ECHO What do you want to skin?;#NOOP %-1} {#VAR SkinTarget {%1};#VAR SkinFunction {%2};#TEMP "SkinPrep" {(%w) in your right hand} {#UNTRIGGER SkinPrepFail;weapon_temp="%%1";put my %1 in my @sheath;#T+ Skin2;get @skinning_kinfe from my @skinning_knife_holder};glance;#ALARM "SkinPrepFail" {+10} {#ECHO glance did not locate weapon, assuming no weapon was held.;#UNTRIGGER SkinPrep;weapon_temp="";#T+ Skin2;get @skinning_knife from my @skinning_knife_holder}}}
#VAR skinning_knife {}
#VAR skinning_knife_holder {}
#VAR SkinTarget {} {}
#VAR SkinFunction {} {}
#CLASS 0
#CLASS {Skinning|Skin2} {disable}
#VAR SkinResult {} {}
#TRIGGER {I could not find what you were referring to.} {#ECHO ** Skinning knife could not be found! **;#IF (@weapon_temp) {get my @weapon_temp};#UNVAR weapon_temp;#T- Skin2}
#TRIGGER {You remove} {kneel;skin @SkinTarget}
#TRIGGER {You skinned} {#ADD Skin_Success 1;SkinResult="success";stand}
#TRIGGER {{You botched the job.|You can only skin creatures!}} {#ADD Skin_Fail 1;SkinResult="fail";stand}
#TRIGGER "SkinStand" {({You are already|You stand back up.|You struggle})} {#IF ("%1"="You struggle") {#STATE SkinStand 0;#ALARM {+1} {stand}} {put my @skinning_knife in my @skinning_knife_holder}}
#COND "SkinStand" {You put} {#IF (@SkinFunction) { #IF (@SkinResult="success") {get @SkinFunction;open my @loot_container;put my @SkinFunction in my @loot_container;#STATE SkinStand 1;SkinResult="success2"} { #IF (@SkinResult="success2") {close my @loot_container;#STATE SkinStand 0} { #STATE SkinStand 2}}} { #STATE SkinStand 2}}
#COND "SkinStand" {} {search @SkinTarget;#IF (@weapon_temp) {get my @weapon_temp};#UNVAR weapon_temp;#T- Skin2} {manual}
#CLASS 0 |
|
|
![](templates/Classic/images/spacer.gif) |
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Wed Feb 19, 2003 1:21 am |
Okay that looks pretty complicated, but I'm sure I'll figure it out when I study it with the helpfile handy :) Thanks a ton. The cool thing about the wizard's script language is that its possible for a total newbie to figure it out and make useful scripts in no time at all, but it is VERY restrictive in what it can do(no capturing text and things like that). The pause command simply pauses for one second *or* however much round time you have, which is another issue with gemstone that will need to be tackled. Anyways, thanks again! I'll prolly have some questions tomorrow :p
-Stregone |
|
|
![](templates/Classic/images/spacer.gif) |
|
|
|
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
|
|