Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Converting TinyFugue scripts to MushClient

Converting TinyFugue scripts to MushClient

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Winddancer   (26 posts)  Bio
Date Tue 25 Oct 2022 03:32 PM (UTC)
Message
After years of absence I wanted to play muds again and wanted to move from TF to MushClient. As I had a good set of scripts for TF I got stuck converting some of the stuff. Maybe someone can help me here.

The original TF script looks like this:

/alias delay3 \
	/repeat -3 1 %*

/alias delay3.5 \
	/repeat -3.5 1 %*

/alias tw throw $[myweapon] at enemy%;get $[myweapon]%;\
	/if ({twohandedmode} = 0) \
		delay3 wield $[myweapon] in both hands%; \
	/elseif ({twohandedmode} = 1) \
		delay3.5 wield $[myweapon]%; \
	/endif%;


Depending on wether or not the weapon I plan to throw is twohanded or not, I need to wait a different amount of time.
I got triggers set up that
a) catch the name of the weapon I use and store it in variable myweapon
b) depending on the message the mud produces, a trigger determines wether or not the weapon is twohanded and then sets the variable twohandedmode accordingly.

How would I do all this in MUSHclient?
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Tue 25 Oct 2022 07:33 PM (UTC)

Amended on Tue 25 Oct 2022 07:34 PM (UTC) by Fiendish

Message
The time delay would probably be the DoAfterSpecial script function ( https://www.mushclient.com/scripts/doc.php?function=DoAfterSpecial ).

For the variable setting and retrieval, I think you want to watch the demo Nick put together for making a targeting alias. https://www.mushclient.com/forum/?id=9616

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Winddancer   (26 posts)  Bio
Date Reply #2 on Wed 26 Oct 2022 11:51 AM (UTC)
Message
Hmm, seems I got most of it working, thanks...
However, not getting the call for the DoAfterSpecial right yet.
Probably a question of the sendto,

So far the alias looks like this:

 <alias
   match="tw"
   enabled="y"
   expand_variables="y"
   group="throwing"
   send_to="12"
   sequence="100"
  >
  <send>throw @myweapon at enemy
get @myweapon
DoAfterSpecial (4, wield @myweapon, sendto.world)</send>
  </alias>
Top

Posted by AdInfinitum   (74 posts)  Bio
Date Reply #3 on Wed 26 Oct 2022 02:57 PM (UTC)

Amended on Wed 26 Oct 2022 03:06 PM (UTC) by Fiendish

Message
Winddancer said:

Hmm, seems I got most of it working, thanks...
However, not getting the call for the DoAfterSpecial right yet.
Probably a question of the sendto,

So far the alias looks like this:

 <alias
   match="tw"
   enabled="y"
   expand_variables="y"
   group="throwing"
   send_to="12"
   sequence="100"
  >
  <send>throw @myweapon at enemy
get @myweapon
DoAfterSpecial (4, wield @myweapon, sendto.world)</send>
  </alias>



You're mixing up syntaxes here. You have literal commands that you would send, mixed in with Lua code. You have send_to="12", which means all the code in 'send' tags needs to be in Lua code. Also, commands in DoAfterSpecial must be encased in quotes.

Change what's in the send tags to this:


local myweap = GetVariable("myweapon")
Send("throw " .. myweap .. " at enemy")
Send("get " .. myweap)
DoAfterSpecial(4, "wield " .. myweap, sendto.world)
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #4 on Wed 26 Oct 2022 03:01 PM (UTC)

Amended on Wed 26 Oct 2022 03:06 PM (UTC) by Fiendish

Message
This part:
send_to="12"

means that everything between
<send>
and
</send>
is going through the script engine. That's good, because it's needed for DoAfterSpecial to work.
However...


throw @myweapon at enemy
get @myweapon

Because we're in the script engine now and not just dumping commands at the game, this stuff needs the Send() function to be sent to the game, like:

Send("throw @myweapon at enemy")
Send("get @myweapon")


Note also that I put quotation marks around what's being sent, because now it's some text being given to the Send function to do something with.

We also need to do the same for the next line, like this:

DoAfterSpecial (4, "wield @myweapon", sendto.world)



AdInfinitum's use of GetVariable, the local script variable myweap, and string concatenation with .. is another way to do the same thing.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by AdInfinitum   (74 posts)  Bio
Date Reply #5 on Wed 26 Oct 2022 03:15 PM (UTC)
Message
Fiendish said:

AdInfinitum's use of GetVariable, the local script variable myweap, and string concatenation with .. is another way to do the same thing.


It's funny, because I absolutely missed the expand_variables option. I don't use it much, so I tend to overlook that.

Fiendish's way is much more cleaner. Use his.
Top

Posted by Winddancer   (26 posts)  Bio
Date Reply #6 on Wed 26 Oct 2022 03:17 PM (UTC)
Message
Thanks a bunch...
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,336 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.