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, confirm your email, resolve issues, 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 ➜ Tips and tricks ➜ Targetting

Targetting

Posting of new messages is disabled at present.

Refresh page


Pages: 1  2 

Posted by Sarah   Germany  (8 posts)  Bio
Date Reply #15 on Fri 26 Jan 2007 09:01 PM (UTC)
Message
Hi,

I copied this code in my script file:

sub SetTarget (sName, sLine, wildcards)
world.SetVariable "target", wildcards (1)
end sub

Now, when I try to reload the script file, I get the following error:

Error number: 0
Event: Compile error
Description: [string "Script file"]:1: `=' expected near `SetTarget'
Called by: Immediate execution

I must say that I have no clue about scripting. But this code was something that I was searching for. And so I enabled scripting in Mushclient and set my script file, but the file is empty except the code above which I copied.

What did I do wrong?

Thanks for your help

Sarah
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #16 on Fri 26 Jan 2007 11:18 PM (UTC)
Message
You have set Lua as your script language (which is recommended), however that little bit of script is for Visual Basic (VBscript).

The Lua version would be:


function SetTarget (sName, sLine, wildcards)
  world.SetVariable ("target", wildcards [1])
end -- function


However the easier thing is to "send to script" which means you don't need to use a script file at all.

To do that, use "send to script" and just do something like this:


<aliases>
  <alias
   match="target *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable ("target", "%1")</send>
  </alias>
</aliases>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #17 on Fri 26 Jan 2007 11:20 PM (UTC)
Message
But, if all you want to do is set a variable, you don't need to script at all:


<aliases>
  <alias
   match="target *"
   enabled="y"
   variable="target"
   send_to="9"
   sequence="100"
  >
  <send>%1</send>
  </alias>
</aliases>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #18 on Fri 26 Jan 2007 11:20 PM (UTC)
Message
Read this post if the XML code is confusing you:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4777

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Sarah   Germany  (8 posts)  Bio
Date Reply #19 on Sat 27 Jan 2007 01:27 PM (UTC)
Message
Many thanks for your help, I took the code in lua and now it works!
Thank you very much!

Greetings
Sarah
Top

Posted by Benjamin   (2 posts)  Bio
Date Reply #20 on Sun 02 Dec 2007 05:38 AM (UTC)
Message
hi i have a problem with making a targeting alias. I looked at what you gave to other people and i thought i could just do that, but it seems like it didnt work. I tried

function SetTarget (sName, sLine, wildcards)
world.SetVariable ("target", wildcards [1])
end -- function


but it gave me an error when i was tryng to use the plugin to put this in.

Line 3: Expected '<', got "f" (content not permitted here) (problem in this file) is what it says
p.s i know nothing about scpriting or anything
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #21 on Sun 02 Dec 2007 07:22 PM (UTC)
Message
What you have there is a bit of script. Can you post the whole plugin? Taken out of context it is hard to see what is happening.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #22 on Mon 03 Dec 2007 07:06 AM (UTC)
Message
I think the issue is that he is using it as a plugin, and not as a script file. That is my take on the expected < but found f, message. Plugins expect XML, and scripts don't.

-Onoitsu2
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.


73,175 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

Posting of new messages is disabled at present.

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.