Prev_page Previous 1
Selling script 08/16/2009 11:22 AM CDT
In the process of trying to write two scripts, one for selling fish in Langenfirth and one for selling gems, I had a couple of questions about scripting in StormFront and hoped this would be the place to ask.

I didn't want to have to write a separate chunk of "get gem, sell gem" for every one of the fifty-odd gem types, as that seemed like an inelegant waste of time. But I couldn't figure out how to do a FOR loop with anything except the nine command-line variables (using IF_# and SHIFT). Which obviously isn't enough. Is there some trick to iterating a loop a set number of more than nine times, exiting the script when you hit that top number?

I also couldn't figure out a way to do an "IF-THEN-ELSE" loop. Like, I wanted to do something like "PUT LOOK and if you don't see the description of the fishmonger's cabin, tell the user to hie there immediately and quit."

What I ended up doing was setting variables for each of the fish and looping through them with the counter. The last variable I set as "pole", so the script goes through all the fish possibilities, gets the pole, tries to weigh it, then terminates when it gets the message that poles can't be weighed.

With gems, I did the same basic thing, but have the user put some non-gem item in the gem pouch like grass. I then assign %1 to the last variable. When the script gets to that last one and tries to sell it, it quits when it gets the response from the gem buyer that it is not a gem or metal.

Both of those work, and the resulting scripts are much shorter and easier to update than the others I've downloaded, but it seems a bit kludgey. Is there a better way that I've missed?

Thanks in advance for any tips.

_________________________________
The HeroMachine 3 Alpha is now open
for public testing if you want to
make a portrait of your character --
http://www.heromachine.com
Reply
Re: Selling script 08/16/2009 11:27 AM CDT
If you can call one script from another in SF, then create one that loops through shift and another that calls the looping one with all the gems on the command-line.

But there is no shift for regular variables.

Obligatory reference to how easy this would be to do with Genie ;-P

-pete
Reply
Re: Selling script 08/16/2009 11:29 AM CDT
Not in stormfront.

Stormfront is... very limited by the lack of If_then




Dartenian says, "The thing that makes Dragon Dance king is that it pretty much bonuses every single that can possibly be buffed for combat. Including at least two things that don't even exist."
Reply
Re: Selling script 08/16/2009 12:08 PM CDT
>If you can call one script from another in SF, then create one that loops through shift and another that calls the looping one with all the gems on the command-line.

I thought about this, and even started working on it, but came up short when I realized that the command line is limited to nine variables (or so it appears from the help section, I was hoping that's wrong but didn't have the heart to try it), and a lot more than nine kinds of fish or gems.

The other big hurdle I ran into was the use of "PUT" with a multiple-variable variable. I originally thought I could have varibles like "gem1" "gem2" "gem3" etc, and in the script use the counter for "put get %gem%c". But the actual output was not "get kunzite" as you'd hope (assuming "gem1" was "kunzite") but rather the literal string "gem1" or whatever the counter was at that point. Very frustrating. Eventually I got over that by making a new variable as follows:

>setvariable newGem %gem%c

I could then use "put get %newgem" and it worked as expected, outputting "get kunzite" where gem1 was "kunzite" and not the literal string "gem1".

I'm thinking now that for the gem script, at least, I ought to be able to do something with "LOOK IN MY GEM POUCH" but the problem with that is scroll -- I didn't want to have at least 57 "So and so looks in his gem pouch", and maybe dozens more depending on how many gems of each type you have.

So far the "terminating non-fish/non-gem item in the container" approach is working pretty well. The whole script is just a few dozen lines, and if I forget a fish or gem (which I did with gems), it's easy to just add a new "setvariable" line at the top and it's good to go. I never liked the old scripts where there were two big chunks of code for each possible gem type, plus how slow it was with all the pauses. This way's a lot faster.

Thanks for the comment, Mozzik, I am glad to know such loop logic doesn't exist in SF and not that I was just stupid, although I kind of wish I were just stupid so there'd be an elegant solution. Oh well.

_________________________________
The HeroMachine 3 Alpha is now open
for public testing if you want to
make a portrait of your character --
http://www.heromachine.com
Reply
Re: Selling script 08/16/2009 12:16 PM CDT
>>Thanks for the comment, Mozzik, I am glad to know such loop logic doesn't exist in SF and not that I was just stupid, although I kind of wish I were just stupid so there'd be an elegant solution. Oh well.

... It's Genie. I've been putting off switching over for quite awhile now. I think Smegul will hit me if I don't soon though.



Dartenian says, "The thing that makes Dragon Dance king is that it pretty much bonuses every single that can possibly be buffed for combat. Including at least two things that don't even exist."
Reply
Re: Selling script 08/16/2009 12:21 PM CDT
Here's my Genie gem selling script. It doesn't need to know any type of gem it'll just rummage the pouch once then sell everything in it. I <3 Genie.

## Gem Seller by Dasffion. Much of the code actually written by Copernicus and Saet

action var contents $1 when ^You rummage through .+ and see (.*)\.

put rummage my pouch
waitforre ^You rummage

eval contents replace("%contents", ", ", "|")
eval contents replace("%contents", " and ", "|")
var contents |%contents|
eval total count("%contents", "|")

Loop:
eval item element("%contents", 1)
eval number count("%contents", "|%item")
var count 0
gosub RemoveLoop
action setvariable item $1 when ^@a .* (\S+)$
put #parse @%item
counter set %count
gosub sellgem
if %contents != "|" then goto Loop
exit

RemoveLoop:
eval number count("%contents", "|%item|")
eval contents replace("%contents", "|%item|", "|")
eval contents replace("%contents", "||" "|")
evalmath count %count + %number
if !contains("%contents", "|%item|") then return
goto RemoveLoop

sellgem:
counter subtract 1
put get my %item
pause 0.2
put sell my %item
pause 0.5
if %c = 0 then return
goto sellgem
Reply
Re: Selling script 08/16/2009 12:53 PM CDT
>I thought about this, and even started working on it, but came up short when I realized that the command line is limited to nine variables (or so it appears from the help section, I was hoping that's wrong but didn't have the heart to try it), and a lot more than nine kinds of fish or gems.

It isn't... That is what SHIFT is for.

Try this...

#Test of SHIFT
START:
IF_1 GOTO MORE
GOTO END
MORE:
ECHO %1
SHIFT
GOTO START
END:
EXIT

Then call it like this:
.test 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

You should see 1-15 displayed in echoes.

-pete
Reply
Re: Selling script 08/16/2009 01:01 PM CDT
>LUXORTH's script

This script is awesome. I've been using it ever since you posted it. Since I don't use bundles (fangs, tusks, etc), I also did one to sell skins using the same template.

And when Genie's author adds more array handling functions it'll even be better.

-pete
Reply
Re: Selling script 08/16/2009 02:03 PM CDT
Faster G3 gem selling script:

include base.cmd
var pouch1contents
var pouch2contents
var packContents
var typeaheads 2
action var pouch1contents $1 when ^You rummage through a .+ pouch looking for gems and see (.+)\.
action var packContents $1 when ^You rummage through a.+backpack looking for gems and see (.+)\.
action math sell.queue subtract 1 when ^You get|^You ask.+to buy|^What were you referring to\?|^Sell what\?|^Oweede takes your
gosub rummage /g my pouch
action var pouch2contents $1 when ^You rummage through a .+ pouch looking for gems and see (.+)\.
gosub rummage /g my second pouch
gosub rummage /g my backpack

var gem.list %pouch1contents, %pouch2contents, %packContents
#echo %gem.list

var sell.queue 0
gosub sell.x copper bar
gosub sell.x bronze bar
gosub sell.x silver bar
gosub sell.x gold bar
gosub sell.x platinum bar
gosub sell.x nugget
gosub sell.x zircon
gosub sell.x turquoise
gosub sell.x tsavorite
gosub sell.x tourmaline
gosub sell.x topaz
gosub sell.x tanzanite
gosub sell.x sunstone
gosub sell.x star-stone
gosub sell.x spinel
gosub sell.x sapphire
gosub sell.x ruby
gosub sell.x quartz
gosub sell.x peridot
gosub sell.x pearl
gosub sell.x opal
gosub sell.x onyx
gosub sell.x morganite
gosub sell.x moonstone
gosub sell.x lazuli
gosub sell.x kunzite
gosub sell.x jade
gosub sell.x ivory
gosub sell.x iolite
gosub sell.x hematite
gosub sell.x garnet
gosub sell.x emerald
gosub sell.x diopside
gosub sell.x diamond
gosub sell.x crystal
gosub sell.x coral
gosub sell.x citrine
gosub sell.x chrysoprase
gosub sell.x chrysoberyl
gosub sell.x chalcedony
gosub sell.x carnelian
gosub sell.x bloodstone
gosub sell.x beryl
gosub sell.x aquamarine
gosub sell.x andalusite
gosub sell.x amethyst
gosub sell.x amber
gosub sell.x alexandrite
gosub sell.x agate
gosub sell.x waermodi stones
gosub sell.x lasmodi stones
gosub sell.x sjatmal stones
gosub sell.x lantholite stones
gosub sell.x seordstone talon
put stretch
exit

sell.x:
var sell.item $0
eval number.to.sell count("%gem.list","%sell.item")
if %number.to.sell = 0 then return
selling.x:
gosub wait.sell.queue
math sell.queue add 1
put get my %sell.item
gosub wait.sell.queue
put sell my %sell.item
math sell.queue add 1
math number.to.sell subtract 1
if %number.to.sell > 0 then goto selling.x
return

wait.sell.queue:
if %sell.queue <= %typeaheads then return
pause .1
goto wait.sell.queue
Reply
Re: Selling script 08/16/2009 03:48 PM CDT
>>... It's Genie. I've been putting off switching over for quite awhile now. I think Smegul will hit me if I don't soon though.

It's only fair, I beat him in the head to make him do it.


******************
SEND[Bramoir] Okay, you are all set, just make sure you use your name for the powers of good okay?
******************
Reply
Re: Selling script 08/16/2009 05:38 PM CDT
Welp, for what it's worth, here's the StormFront script I ended up with. I'm too crusty to move to a different front end just for the scripting. Thanks to PBombard for the tip on SHIFT, that's really good to know.




echo * USAGE IS .sellgems <non-gem item>, where
echo * <non-gem item> is a non-gem you have placed
echo ** in your gem pouch.

# Set variables for all gems.
setvariable gem1 Agate
setvariable gem2 Alexandrite
setvariable gem3 Amber
setvariable gem4 Amethyst
setvariable gem5 Andalusite
setvariable gem6 Aquamarine
setvariable gem7 Beryl
setvariable gem8 Bloodstone
setvariable gem9 Carnelian
setvariable gem10 Chakrel
setvariable gem11 Chalcedony
setvariable gem12 Chrysoberyl
setvariable gem13 Chrysoprase
setvariable gem14 Citrine
setvariable gem15 Coral
setvariable gem16 Crystal
setvariable gem17 Diamond
setvariable gem18 Diopside
setvariable gem19 Dwalgim
setvariable gem20 Eldring
setvariable gem21 Emerald
setvariable gem22 Garnet
setvariable gem23 Glowstone
setvariable gem24 Granite
setvariable gem25 heart
setvariable gem26 Hematite
setvariable gem27 Iolite
setvariable gem28 Ivory
setvariable gem29 Jade
setvariable gem30 Jasper
setvariable gem31 Kunzite
setvariable gem32 Lazuli
setvariable gem33 Metal
setvariable gem34 Moonstone
setvariable gem35 Morganite
setvariable gem36 Onyx
setvariable gem37 Opal
setvariable gem38 Pearl
setvariable gem39 Peridot
setvariable gem40 Quartz
setvariable gem41 Ruby
setvariable gem42 Sapphire
setvariable gem43 Spinel
setvariable gem44 Star-stone
setvariable gem45 Stone
setvariable gem46 Sunstone
setvariable gem47 Svelae
setvariable gem48 Tanzanite
setvariable gem49 Tear
setvariable gem50 Topaz
setvariable gem51 Tourmaline
setvariable gem52 Tsavorite
setvariable gem53 Turquoise
setvariable gem54 Zircon
setvariable gem55 nugget
setvariable gem56 bar
setvariable gem57 %1

# Make sure there's a terminator variable.
If_1 goto start
echo * You must enter the name of the non-gem item in your gem pouch! *
exit

# Make sure the hands are empty to begin with.
start:
counter set 1
put stow right
put stow left
pause 1
put open gem pouch
echo * Starting to sell gems *
goto getGem

getGem:
save getGem
setvariable newGem %gem%c
match Pause_For_System ...wait
match sellGem You get
match newGem referring
put get %newGem from my gem pouch
matchwait

sellGem:
save sellGem
match done don't buy those
match Pause_For_System ...wait
match getGem hands you
put sell %newGem
matchwait

newGem:
counter add 1
goto getGem

Pause_For_System:
echo * pause for system *
Pause 1
Goto %s

done:
put put my %1 in my gem pouch
echo * ALL DONE! *
exit






_________________________________
The HeroMachine 3 Alpha is now open
for public testing if you want to
make a portrait of your character --
http://www.heromachine.com
Reply
Re: Selling script 08/16/2009 05:56 PM CDT
I find using something like this easier to use and edit since there's less variable juggling/setting:

#sell
if_9 goto start
put .sell gem1 gem2 gem3 ... gemx
exit

start:
### rest of script using shift to move down the list

I've used this general concept for everything from gem selling and gem clarifying to sorting inventory. For another way that it can be used see Aveda's instrument training script for SF. Its used in conjunction with saved variables to save your play difficulties between use.

<<I thought about this, and even started working on it, but came up short when I realized that the command line is limited to nine variables (or so it appears from the help section, I was hoping that's wrong but didn't have the heart to try it), and a lot more than nine kinds of fish or gems.

To expand on what PBOMBARD said... The command line isn't limited to nine variables. The user is only limited in picking out the first nine using %1 to %9. %0 will return the entire string including beyond the ninth variable, and shifting will shift them into usable position.

-Evran

Crackling with unspent rage since 386A.V.
Reply
Re: Selling script 08/16/2009 06:12 PM CDT
This kind of reminds me how everyone used to have complex scripts to pick up all the gems in the room, and then stow gem was released. If only selling pouches wasn't arbitrarily restricted to traders...
Reply
Re: Selling script 08/16/2009 06:28 PM CDT
... in some locations...




Dartenian says, "The thing that makes Dragon Dance king is that it pretty much bonuses every single that can possibly be buffed for combat. Including at least two things that don't even exist."
Reply
Re: Selling script 08/16/2009 06:53 PM CDT
My sell script. It sells everything via rummage. .sell backpack /g. Would sell every gem in your backpack. I like this function because you can toss your gem pouch out, letting you store everything in your backpack. Also works with custom, .sell backpack "/c ruby".

.sell (container) (rummage options)

This script uses the new array functionality too. Enjoy.



## Created by Kurav

varset:
var type %1
var contents "empty"
var item

actions:
action var contents $1 when ^You rummage .* and see (.+)\.$

## changes capture string into an array and counts variables
setup:
pause 0.2
put rummage %2 my %type
wait
eval contents replace("%contents",", ", "|")
eval contents replace("%contents"," and ","|")
eval item.max count("%contents", "|")
echo %item.max items.
counter set 0

## sell loop via array
sell:
if "%contents(%c)" = "" then goto done
if matchre("%contents(%c)@", (".+ (\w+)@") then var item $1
put get my %item from my %type
put sell my %item
counter add 1
## merchant match, may need to be changed/added depending on merchants or items being told
match sell hands you
matchwait 5

done:
echo Items Sold
put #parse sell.cmd done.
exit
Reply
Re: Selling script 08/16/2009 06:59 PM CDT
Thanks to everyone posting scripts. I hadn't gotten around to writing a new one yet, just been running to Rossman's to sell instead.

--Player of Szrael --

Professional Healers Association Fee Calculator: http://empathunion.appspot.com

Upcoming PHA Meeting -- Sunday August 16th at 5PM EST aboard the Jolly Roger ship, moored to the Skirr dock in Crossing.
Reply
Re: Selling script 08/17/2009 05:57 AM CDT
Sell anything from a pocket

.sell "specific pocket" item1 item2 "item 3" item.4

#M:Sell my anything
Setvariable xpocket %1
shift
GEt:
echo ******************************
echo * *
echo * Selling all your stuff *
echo * *
echo ******************************

Get2:
put get my %1 in my %xpocket
match next referring
match sell You get
MatchWait

sell:
put sell my %1
match GEt2 hands you
match next2 worth my time
Matchwait
Next:
pause
shift
if_1 goto get2
goto clearv
next2:
if_1 put put my %1 in my %xpocket
if_1 goto get2

clearv:
If_1 shift
if_1 goto Clearv

END:

Selling gems from "cheap" gem pouch(I'm missing some of the gem types).

counter set 1
shift
put look
match anthelorm Anthelorm
match appraiser a dwarven appraiser
match Veilex Veilex
match Veilex Fatimi's son
match Fatimi Fatimi
match kurtz Kurtz
match magpie old Mother Magpie
match gruk Gruk
match aesery Elothean woman
matchwait
Fatimi:
setvariable shopkeeper Fatimi
setvariable currency dokora
goto next
Kurtz:
setvariable shopkeeper kurtz
setvariable currency dokora
goto next
Veilex:
setvariable shopkeeper Veilex
setvariable currency dokora
goto next
Anthelorm:
setvariable shopkeeper Anthelorm
setvariable currency lirum
goto next
aesery:
setvariable shopkeeper woman
setvariable currency lirum
goto next
appraiser:
setvariable shopkeeper appraiser
setvariable currency kronar
goto next
Gruk:
setvariable shopkeeper Gruk
setvariable currency lirum
goto next
magpie:
setvariable shopkeeper Magpie
setvariable currency Lirum
goto next
GEt:
echo ******************************
echo * *
echo * Selling all your %gem%s
echo * *
echo ******************************

Get2:
put get my %gem% in my %cheapgem
match next referring
match %currency You get
MatchWait

dokora:
put ask %shopkeeper to app my %gem
matchre rare /(7\d\d\d|8\d\d\d|9\d\d\d|0\d\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/
matchre rare /(5\d\d|6\d\d|7\d\d|8\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/
matchre favor /(3\d\d|4\d\d)/
matchre sell /(1\d|2\d|3\d|4\d|5\d|6\d|7\d|8\d|9\d|1\d\d|2\d\d)/
matchwait

lirum:
lirums:
put ask %shopkeeper to app my %gem
matchre rare /(7\d\d\d|8\d\d\d|9\d\d\d|0\d\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/
matchre rare /(5\d\d|6\d\d|7\d\d|8\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/
matchre favor /(3\d\d|4\d\d)/
matchre sell /(1\d|2\d|3\d|4\d|5\d|6\d|7\d|8\d|9\d|1\d\d|2\d\d)/
matchwait

kronar:
put ask %shopkeeper to app my %gem
matchre rare /(7\d\d\d|8\d\d\d|9\d\d\d|0\d\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/
matchre rare /(6\d\d|7\d\d|8\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/
matchre favor /(4\d\d|5\d\d)/
matchre sell /(1\d|2\d|3\d|4\d|5\d|6\d|7\d|8\d|9\d|1\d\d|2\d\d|3\d\d)/
matchwait

favor:
put put %gem in my %favorgem
goto get2

rare:
put put %gem in my %raregem
goto get2

sell:
put sell my %gem
match GEt2 hands you
match next2 worth my time
Matchwait
next2:
put drop my %gem
Next:
put look in my %cheapgem
match nextpouch There is nothing in there.
match ag agate
matchre Am /(amethyst|amber)/
match and andalusite
match aq aquamarine
matchre bar /(bar,|bar.)/
match Bloodstone bloodstone
match ca carnelian
matchre ch /(chrysoprase|chrysoberyl)/
match co coral
matchre Crystal /(crystal,|crystal.)/
match Diopside diopside
match emerald emerald
match ga garnet
matchre Gem /(aquamarine gem|turquise gem)/
match goldstone goldstone
match he hematite
match io iolite
match iv ivory
matchre Ja /jasper|jade/
match ku kunzite
match la lazuli
match malachite malachite
matchre mo /morganite|moonstone/
match Nugget nugget
matchre pe /(peridot|pearl)/
match Quartz quartz
matchRE stone /( stones,| stones.| stones and| stone,| stone.| stone and)/
match sapphire sapphire
match sp spinel
matchre To /( to| To)/
match tu turquoise
match Opal opal
match quartz quartz
match Ruby ruby
match Zircon zircon
match gempouch referring
matchwait

ag:
setvariable gem ag
goto get
am:
setvariable gem am
goto get
and:
setvariable gem and
goto get
aq:
setvariable gem aq
goto get
bar:
setvariable gem bar
goto get
bloodstone:
setvariable gem bloodstone
goto get
ca:
setvariable gem ca
goto get
ch:
setvariable gem ch
goto get
co:
setvariable gem co
goto get
crystal:
setvariable gem crystal
goto get
diopside:
setvariable gem diopside
goto get
emerald:
setvariable gem emerald
goto get
ga:
setvariable gem ga
goto get
gem:
setvariable gem gem
goto get
goldstone:
setvariable gem goldstone
goto get
he:
setvariable gem he
goto get
io:
setvariable gem io
goto get
iv:
setvariable gem iv
goto get
ja:
setvariable gem ja
goto get
ku:
setvariable gem ku
goto get
la:
setvariable gem la
goto get
malachite:
setvariable gem stone
goto get
mo:
setvariable gem mo
goto get
nugget:
setvariable gem nugget
goto get
opal:
setvariable gem opal
goto get
pe:
setvariable gem pe
goto get
quartz:
setvariable gem quartz
goto get
ruby:
setvariable gem ruby
goto get
sapphire:
setvariable gem sapphire
goto get
sp:
setvariable gem sp
goto get
stone:
setvariable gem sto
goto get
to:
setvariable gem to
goto get
tu:
setvariable gem tu
goto get
Zircon:
setvariable gem zircon
goto get

nextpouch:
put rum my %cheapgem
match purple%c% purple gem pouch
match red red gem pouch
match green green gem pouch
match blue blue gem pouch
match black black gem pouch
match indigo indigo gem pouch
match fuzzy fuzzy gem pouch
match dark dark gem pouch
matchwait
purple1:
counter set 2
setvariable cheapgem red pouch
goto next
purple2:
goto clearv
red:
setvariable cheapgem green pouch
goto next
green:
setvariable cheapgem blue pouch
goto next
blue:
setvariable cheapgem black pouch
goto next
black:
setvariable cheapgem indigo pouch
indigo:
setvariable cheapgem fuzzy pouch
goto next
fuzzy:
setvariable cheapgem dark pouch
goto next
dark:
setvariable cheapgem purple pouch
goto next
gempouch:
setvariable cheapgem gem pouch
#see a red, purple, indigo, blue, green, soft, indigo, black, suede, fuzzy, dark

clearv:
setvariable cheapgem purple pouch
deletevariable gem
deletevariable box

END:


Welcome to the Match, Wizard/Stormfront version of IF/Then/Else

What do you mean SF doesn't have an IF_Then?

IF_1 put Smack %1


If there were no cost or sacrifice involved, there wouldn't be any benefits worth learning, and the entire system would be pointless. --GM Wythor

These statements were not endorsed or made by a GM and may be completely irrealavent to game play.
Reply
Re: Selling script 08/17/2009 06:56 AM CDT
>> Welcome to the Match, Wizard/Stormfront version of IF/Then/Else

>>What do you mean SF doesn't have an IF_Then?

>>IF_1 put Smack %1

/facepalm
Reply
Re: Selling script 08/17/2009 08:27 AM CDT
>> Welcome to the Match, Wizard/Stormfront version of IF/Then/Else

>>What do you mean SF doesn't have an IF_Then?

>>IF_1 put Smack %1


Now try


setvariable poster Shnurui

if %poster = Shnururi then put smack %poster

if_1 is not the same as If then
Reply
Re: Selling script 08/17/2009 09:32 AM CDT
>> Welcome to the Match, Wizard/Stormfront version of IF/Then/Else

>>What do you mean SF doesn't have an IF_Then?

>>IF_1 put Smack %1

>/facepalm

If you're going to facepalm, at least get it right. IF_1 is a binary check. Matchtables are a lot more similar to a standard if/then/else command than IF_1, despite the words being similar. There's also variations on goto blah%c with errorlabel as a backup. However, you have to realize that these are all crude approximations of a true if/then/else command.
Reply
Re: Selling script 08/17/2009 06:06 PM CDT
>matchre rare /(7\d\d\d|8\d\d\d|9\d\d\d|0\d\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/

So...

\d = ?
Reply
Re: Selling script 08/17/2009 06:12 PM CDT
>>\d = ?

A digit value of 0-9
Reply
Re: Selling script 08/17/2009 06:14 PM CDT
>>>matchre rare /(7\d\d\d|8\d\d\d|9\d\d\d|0\d\d\d|9\d\d|1\d\d\d|2\d\d\d|3\d\d\d|4\d\d\d|5\d\d\d|6\d\d\d)/

Without looking at it closely, I'm like 99% certain that there is a shorter way to do this.



TG, TG, GL, et al.
Also: Moo.
Reply
Re: Selling script 08/17/2009 06:25 PM CDT
If I correctly interpret what you're trying to do:
(worth 1000 or more)

matchre rare /[1-9][0-9]{3,}/



TG, TG, GL, et al.
Also: Moo.
Reply
Re: Selling script 08/17/2009 06:33 PM CDT
>/facepalm

>> If you're going to facepalm, at least get it right. IF_1 is a binary check. Matchtables are a lot more similar to a standard if/then/else command than IF_1, despite the words being similar. There's also variations on goto blah%c with errorlabel as a backup. However, you have to realize that these are all crude approximations of a true if/then/else command.

... I was /facepalming him. If you look at the bottom of his sell script he posted, he made the comments I quoted. I didn't make that comparison. Yes, technically If_1 IS an if/then statement. But its completely(insanely) limited in its used compared to true IF / THEN. In the spirit of things, us saying SF has no true IF/THEN and then him spouting IF_1 as an example that it DOES, deserves a face palm.

I think we both agree on this. But go read the bottom of shunruis sell script and you will see where my comments came from.
Reply
Re: Selling script 08/17/2009 06:59 PM CDT
>matchre rare /[1-9][0-9]{3,}/

... This actually worked. Sure would be nice if anything on the help page mentioned you could do something like that in the Stormfront scripting engine.

Fail documentation FTW!

... Wait...
Reply
Re: Selling script 08/17/2009 07:16 PM CDT
>I think we both agree on this.

My mistake, I should be more careful about posting before my morning coffee.
Reply
Re: Selling script 08/17/2009 07:20 PM CDT
>>Sure would be nice if anything on the help page mentioned you could do something like that in the Stormfront scripting engine.

http://lmgtfy.com/?q=Regex

The real problem is the broken link to the MSDN page that no longer works.


TG, TG, GL, et al.
Also: Moo.
Reply
Re: Selling script 08/17/2009 09:17 PM CDT
>The real problem is the broken link to the MSDN page that no longer works.

That and my assumption that Stormfront was limited to the examples given.

I don't understand why Stormfront takes so much crap when I can write a script that will do pretty much anything I need it to do even when I'm only scratching the surface of regular expressions in the ones I write.

Then again I've never needed a script that will hunt armadillos for a week while I'm away on vacation.
Reply
Re: Selling script 08/17/2009 09:22 PM CDT
The funny thing is, when I first started scripting with Genie 3 it all seemed really confusing and hard. Really really confusing and hard.

6 months later and I try to go back and write a SF script (wound costs) and I'm sitting there going "Oh god how can anyone write scripts like this, I can't do anything"

And at that moment I really appreciated how easy (and fun) it is to write scripts for Genie.

You can do so much more with so much less. I've taken some scripts (for example Kraelyst's climbing script for Crossing) and cut it down so I was left with one third of what it originally took.
Reply
Re: Selling script 08/17/2009 09:27 PM CDT
If SF can do everything you need you don't need a lot. I can't live without actions if statements, evaluations, profiles, automapper, substitutions ect.
Reply
Re: Selling script 08/17/2009 09:30 PM CDT
>I don't understand why Stormfront takes so much crap when I can write a script that will do pretty much anything I need it to do even when I'm only scratching the surface of regular expressions in the ones I write.

I could probably get my hunting script to work in Stormfront, given a lot of free time to work on it, but it would go from 2500-3000 lines to 4000-5000. Adding gosubs would do a lot.
Reply
Re: Selling script 08/17/2009 09:30 PM CDT
>>If SF can do everything you need you don't need a lot. I can't live without actions if statements, evaluations, profiles, automapper, substitutions ect.

Oh I forgot about the automapper! The fact that I have the ability to make my scripts start ANYWHERE and go to where they need to IS FANTASTIC!!
Reply
Re: Selling script 08/17/2009 09:40 PM CDT
>I don't understand why Stormfront takes so much crap when I can write a script that will do pretty much anything I need it to do even when I'm only scratching the surface of regular expressions in the ones I write.

>Then again I've never needed a script that will hunt armadillos for a week while I'm away on vacation.

When the only tool you have is a hammer, every problem looks like a nail?

I mean you can accomplish almost anything with wizard scripts. The thing is, you can do things more easily and more efficiently (both in terms of script size and runtime optimizations) with a better scripting language. I really enjoy writing new scripts most of the time.
Reply
Re: Selling script 08/17/2009 10:17 PM CDT
>>I really enjoy writing new scripts most of the time.

Genie loves us and wants us to be happy.

--Player of Szrael --

Professional Healers Association Fee Calcs: http://empathunion.com (G3 script and web calc links in the sidebar.)

PHA Crossing Healing spot: east, north, go backdoor from Empath guild. (Try gwething if no one is there!)
Reply
Re: Selling script 08/18/2009 12:53 AM CDT
>I could probably get my hunting script to work in Stormfront, given a lot of free time to work on it, but it would go from 2500-3000 lines to 4000-5000. Adding gosubs would do a lot.

Having built a few, I find the estimation a slight exaggeration, however, if you would like a core that simply needs the little details worked out, I've one you can have.

(I have 2 distinct cores, one for magic, one without, though I don't do ranged, so I don't have a third/fourth)



If there were no cost or sacrifice involved, there wouldn't be any benefits worth learning, and the entire system would be pointless. --GM Wythor

These statements were not endorsed or made by a GM and may be completely irrealavent to game play.
Reply
Re: Selling script 08/18/2009 01:06 AM CDT
>I could probably get my hunting script to work in Stormfront, given a lot of free time to work on it, but it would go from 2500-3000 lines to 4000-5000. Adding gosubs would do a lot.

>Having built a few, I find the estimation a slight exaggeration, however, if you would like a core that simply needs the little details worked out, I've one you can have.

Honestly, I think he's understating the amount of code that genie can save you.

For instance, my script trains several weapons in south barricade celps, defenses and TM in north barricade celps, does shoplifting runs on ratha and in theren/lang and uses the ways to travel between. Of course I have to set a beam on kresh first, and my script doesn't leave unless at least one moon is high enough in the sky to allow me to return. If I get arrested, it pays my fine and resumes. But most importantly, it never gets tripped up due to lag, nor does it rely on the pause command which wastes time.

Granted, pretty much all of this is possible with stormfront, but I don't even want to think what kind of monster of a script this would require.
Reply
Re: Selling script 08/18/2009 01:41 AM CDT
>Granted, pretty much all of this is possible with stormfront, but I don't even want to think what kind of monster of a script this would require.

Me either.

Though with the loot updates and changes to the gathering commands, it has been cut in like, one third.

And you would be better off using linked scripts in SF, because of the one thing that is absolutely not available(in sf itself) a search line # function if you have to fix or tinker.


If there were no cost or sacrifice involved, there wouldn't be any benefits worth learning, and the entire system would be pointless. --GM Wythor

These statements were not endorsed or made by a GM and may be completely irrealavent to game play.
Reply
Re: Selling script 08/18/2009 02:03 AM CDT
>Though with the loot updates and changes to the gathering commands, it has been cut in like, one third.

Granted they were nice additions, but...

You don't even loot in celps. But even if you did, I still don't think it would be close to 1/3 of any real script.
Reply
Re: Selling script 08/18/2009 02:09 AM CDT
>You don't even loot in celps. But even if you did, I still don't think it would be close to 1/3 of any real script.

Depends on what you call a real script. My combat ones are ultra simplified and a mear 134 lines long, include hiding/stalking/skinning and looting. Most of the lines dedicated to hot switches.



If there were no cost or sacrifice involved, there wouldn't be any benefits worth learning, and the entire system would be pointless. --GM Wythor

These statements were not endorsed or made by a GM and may be completely irrealavent to game play.
Reply
Prev_page Previous 1