Scripting with Avalon...too fast? 12/31/2017 02:20 PM CST
Bjornsong here, I've recently moved from Stormfront to Avalon and have ported some of my scripts to the script folder on my new iMac system, they seem to run but I'm having some problems.

First when I run the following simple script Inn.cmd

</s>
<s name="Inn" comment="Traveler's Song">

put sing Take us all home, then we will drink; To my favorite Wayside Inn; A quiet table will do nicely I think; There we can brag of our win; Guide me with magic, guide me with song; I hope to get us home fast; Even if I miss it will not take long; But I like to make the song last
put prepare 1020
Waitrt
put cast

I get the following output in Avalon

>.inn
* Script "inn" started...
script> sing Take us all home, then we will drink; To my favorite Wayside Inn; A quiet table will do nicely I think; There we can brag of our win; Guide me with magic, guide me with song; I hope to get us home fast; Even if I miss it will not take long; But I like to make the song last\
script> prepare 1020\
script> cast\
* Script finished.
>
Please rephrase that command.
>
You sing happily:

"Take us all home, then we will drink
To my favorite Wayside Inn
A quiet table will do nicely I think
There we can brag of our win
Guide me with magic, guide me with song
I hope to get us home fast
Even if I miss it will not take long
But I like to make the song last\"

>
You change your tune slightly, adding the element for Traveler's Song to your song...
Your spellsong is ready.


It looks like the final command cast is not working (Please rephrase that command) but when I just type cast in game after running the script, it works fine.

I have tried introducing script commands wait or waitrt prior to the cast command, but get the same effect. Any ideas?

Also, I have similar issues with travel scripts using the move command. I created a junk.cmd script to move a few rooms...

Move sw
Move s
Move s
Move s
Exit

And here's what I see in game...
>.junk
* Script finished.
>
* Script "junk" started...
script> s\

Please rephrase that command.
>look
[Wehnimer's, Outside Gate]
Citizens, merchants and assorted dregs of society jostle against you before the great wooden gates of Wehnimer's Landing. Harried guards and militiamen try to keep the chaos to a minimum, but it is hard to keep track of those entering, let alone leaving, this large trading post. A dirt path encircling the wooden palisade of the town leads east and southwest. Nailed prominently to the wooden wall beside the gate is a sign you really should read. You also see the Wayside inn.
Obvious paths: north, east, southwest, northwest
>
script> s\
script> s\
Please rephrase that command.
Please rephrase that command.

It seems to "stick" after the first command until I type look, then continues with similar problems. It's like the move command is not waiting properly for the next room description.

Any ideas???
Reply
Re: Scripting with Avalon...too fast? 12/31/2017 02:50 PM CST
I don't like those backslashes.

Did you edit these in a native windows editor? You might pull up the script in textedit and see if there are additional characters at the end of each line (the old cr/lf challenge).

Just a thought. And the same challenge likely exists with your move script.

Doug
Reply
Re: Scripting with Avalon...too fast? 12/31/2017 03:40 PM CST
Wow, quick response! Happy New Year, you know, you're the hardest working support guy I know...you deserve to take tomorrow off :-)

I just used the native TextEdit.app and then changed the .rtf suffix to .cmd using GetInfo.

I ported the text from the .xml Stormfront file, and cut and pasted to TextEdit.app...but retyped a number of the lines in TextEdit so I don't think it's a cut and paste issue.
I also had some old Wizard scripts in an old folder and they have the same issue I think, so it's not anything from the .xml cut and paste.

Also, I noted that when I put quotes (") around the sing text, they display as x86 or some ascii code, so I figured the / is just the newline (CR + LF) from the text editor.

I originally tried /n like in the macros but it doesn't like those either.

I looked through the forums for other example scripts, and I don't see any need to string together continuous text without putting each command on it's own line.

Originally the move scripts were double spaced, so I think I typed the junk script from scratch in TextEdit without using cut and paste, same issue.

Is there any difference for newline (CR+LF) between .rtf and .txt formats? I thought not. And it does perform the sing and prepare 1020 lines properly, so ... no idea!

No rush on this, by the way, so take it easy and have a drink tonight!

Thanks for all you do!

Bjornsong
Reply
Re: Scripting with Avalon...too fast? 12/31/2017 03:50 PM CST
I'm with Doug. I'd recommend looking up using a different editor for them. https://beebom.com/best-text-editors-for-mac/ has some decent options. As I'm a Windows guy, I couldn't tell you what "goto" txt editor on Mac would be. But it definitely shouldn't be putting the \ character on the end.
Reply
Re: Scripting with Avalon...too fast? 12/31/2017 05:05 PM CST
>>support guy

Actually just a player, like most here. I do enjoy helping others enjoy the game, though. And I've seen a lot in my time here.

When you open up one of those scripts in TextEdit, does it have the slash at the end of each of those lines?

If it does, delete those slashes, save and try again.

Doug
Reply
Re: Scripting with Avalon...too fast? 12/31/2017 08:12 PM CST
I use Sublime Text 2 on my Mac and it is awesome! Pretty sure there's a free version with nags in it, least there used to be!

---
Rohese: "... the TownCrier (tune in if you haven’t, it’s without doubt the best thing to ever happen on LNet)"
;tune towncrier

TownCrier News Submission link: http://bit.ly/TownCrierNews
TownCrier News Dailies via Email: http://bit.ly/2ivAJfw
Reply
Re: Scripting with Avalon...too fast? 01/02/2018 05:06 PM CST
Bjornsong again. It looks like it was the .rtf format that is doing it in TextEdit.

Even though the slashes do not appear when editing, it looks like saving as .rtf file is causing the issue.

I found an option in preferences to save as .txt file, and tried creating another script Junk2.cmd from scratch, and that seemed to work with no slashes displayed.

I also recreated Inn.cmd and now all commands including the cast seem to execute.

Now if I could only figure out how to diplay the ascii codes for newline (CR+LF) to figure out the difference!

Anyway, thanks for all of your help. I guess I'll need to recreate all my other scripts as well, as just opening and saving them again with the .txt option didn't seem to change them.
Reply
Re: Scripting with Avalon...too fast? 01/02/2018 05:19 PM CST
Check this out, in particular how to convert from rich text to simple text.

Also, a suggestion - follow the instructions to (in general) open and save files in simple text, and when you save your document, use the CMD or WIZ extension instead of TXT. Double extensions usually mean double the fun in troubleshooting.

http://www.iphonehacks.com/2017/06/plain-text-mode-textedit-mac.html

Doug
Reply
Re: Scripting with Avalon...too fast? 01/05/2018 01:12 PM CST
I'm obviously a little late in reading this one, but the RTF (Rich Text Format) file definitely adds some junk to the code that you don't want in a script. As Doug said, you'll want to either convert your RTF to plain text or find a different editor.

If you're comfortable at all with command line, both vi (built-in on Macs, but you'll want some documentation before you use it) or pico (might also be built-in and is definitely easier to get started with) are good text editors. I'm pretty sure OpenOffice (free download) and Pages (free on the app store) can both save as/export to plain text as well.

Geof
Reply