[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Little help for a Total Newbie?

Little help for a Total Newbie?

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


Pages: 1 2  

Posted by Abas   (6 posts)  [Biography] bio
Date Sun 29 Aug 2004 03:51 AM (UTC)
Message
OK. I just upgraded to WinXp and I can't seem to use my Zmud anymore so I downloaded MUSHclient based on some advised from some mudders.

I am really having problem with MUSHclient since I don't know that much programming.

RIght now, I just want to test Triggers, Variables and few other easy things.

I am trying to create a trigger that can cast a spell on me when it matches some texts from the mud.

from the mud, I am trying to match these;

"Spell Up"

Once it is matched, it should check a variable ( "spell2" in this case) to see if the spell needed to cast itself or not. If spell2 == 0 then cast it, if spell2==1 then no.

So, what I did first was to create a spell2 variable in the Variables page and gave it a value of 0.

Then in the trigger,


-------------------------

Trigger: Spell Up *

Send:
if(@spell2==0)
{
cast "Magic Armor" Ordan ;cast the spell on me
@spell2=1 ;set variable to casted status
}

--------------------

then above trigger didn't work..and I wasn't suprised. :)

ANyone, can someone help me set this trigger up?

give me as much detail/explination as possible; as I am still a newbie on this.100000


addon: basically what I wanted to know is how to do IF/ELSE IF statements and changing variable values in the Send: Box in a trigger.

Thanks.

(From Aardwolf)


[Go to top] top

Posted by Jlzink   USA  (15 posts)  [Biography] bio
Date Reply #1 on Sun 29 Aug 2004 05:11 AM (UTC)
Message
Of course the way you have it would work in ZMud, however MushClient takes a different approach on such things.

Trigger: Spell Up *

Send:
Leave this area blank

Name:cast
Label:cast

I assume that the * is the spell number needed.

Now open notepad. save the file as: whatevername.vbs
In the new VBScripting file put the following stuff

Sub cast(a,b,c)
spell = c(1)
if world.getvariable(spell) = 0 then
world.send "cast " & chr(34) & "Magic Armor" & chr(34) & Ordan 'cast the spell on me
world.setvariable spell,1 'set variable to casted status
end if
end sub


[Go to top] top

Posted by Abas   (6 posts)  [Biography] bio
Date Reply #2 on Sun 29 Aug 2004 05:45 AM (UTC)
Message
Ok. I will try that.


Thanks
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #3 on Mon 30 Aug 2004 03:43 AM (UTC)
Message
You can also put that script into the send box of the trigger itself, remove the "script" box entry, and then change "send to" to script.

And for future reference, just copy the trigger and paste it into the forums (trigger menu, click copy, then paste it here). For something like this it doesnt really matter, but for the future when you have syntax problems or whatnot, it becomes a huge help when we try to figure out which character you missed where.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Abas   (6 posts)  [Biography] bio
Date Reply #4 on Fri 03 Sep 2004 03:30 AM (UTC)

Amended on Fri 03 Sep 2004 05:31 AM (UTC) by Abas

Message
Need more help.


2=========================================================

The Trigger
------------
Trigger: test1
Send:
Send To: Script
Label: test
Script: test




The Script
----------



Sub test(a,b,c)

world.send "The value of MagicArmor is " & " " & world.GetVariable(MagicArmor)

if world.getvariable(MagicArmor) = 0 then
world.send "cast " & chr(34) & "Magic Armor" & chr(34) & Ordan
world.setvariable "MagicArmor",1
end if
world.send "Hello All"
end sub

[Note: MagicArmor is suppose to be my global variable. If it is 0 then the spell is not on me, if it is 1 then it is on. I "Add"ed MagicArmor in the Scripting->Variables section and gave it a value of 0. However, the spell is not casting. :( ]

[Problem, I also get "THere are no value within" from outputing wolrd.GetVariable(MagicArmor). If I comment out If/end if, then world.setvariable "MagicArmor",1 actually set MagicArmor to 1.]
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #5 on Fri 03 Sep 2004 06:35 PM (UTC)
Message
These lines are wrong:

world.send "The value of MagicArmor is " & " " & world.GetVariable(MagicArmor)

if world.getvariable(MagicArmor) = 0 then

You must place "MagicArmor" in quotes. What Mushclient thinks you are doing above is telling it, "Take the value in the 'VBScript' variable MagicArmor and use that to find a Mushclient variable and return its value."

This lets you do things like:

sub setstatus(a, b, c)
Playername = c(1)
setvariable "PS_" & Playername, 1
end sub

In other words, you might match on "Fred joins your party." and the script would set a variable called 'PS_Fred' to 1, to show he is in the party. You could then later run a search on all variables that contain 'PS_' to find a list of player names and which ones are in a party. Basically, you have to remember that getvariable and setvariable have to be given a name in "". If you leave that off, then the script automatically assumes you are now talking about the contents of a script variable, not the name of a Mushclient variable.
[Go to top] top

Posted by Abas   (6 posts)  [Biography] bio
Date Reply #6 on Sat 04 Sep 2004 02:22 AM (UTC)
Message
Ah, ok. I need to put quotes around the variable to get its global value. And no quote will only get me the local value.

I will try that.


Thanks
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #7 on Sat 04 Sep 2004 06:43 AM (UTC)
Message
You probably need to make "Ordan" into a string (when you cast) too (and remember your spaces).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Sun 05 Sep 2004 05:36 AM (UTC)
Message
Quote:

if world.getvariable(MagicArmor) = 0 then
world.send "cast " & chr(34) & "Magic Armor" & chr(34) & Ordan
world.setvariable "MagicArmor",1
end if


You used quotes the second time but not the first. Also you can use quotes inside quotes by doubling them.

You could have done the whole thing in "send to script". That is:

Match: spell up *
Send:


if getvariable ("MagicArmor") = "0" then
  send "cast ""Magic Armor"" Ordan"
  setvariable "MagicArmor", "1" 
end if


Send to: script


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #9 on Sun 05 Sep 2004 10:25 PM (UTC)
Message
I think Nick should just include 2-3 aliases that make triggers/aliases from the command line, so we can tell newbies "Type #trigger {match on;send}" or whatever. Most people find MUSHclient more difficult because they have to go into a dialog box to add triggers, I think.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #10 on Mon 06 Sep 2004 06:44 AM (UTC)
Message
I seriously considered a plugin that would take anything starting with # and parse it into mushclient functions as though it was zmud. Until the addition of 'send to script' though some things where not terribly practical and a few would still be problematic. Since then I came to my senses. ;) lol
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #11 on Mon 06 Sep 2004 06:56 AM (UTC)
Message
Took me about half an hour to explain to someone that we could indeed write an alias to add an alias/trigger, since he wanted to edit on the fly.

It might be a good plugin to make, a whole plugin for ZMud users to feel more like Zmud. Well, without the bloat, and faster. Or at least some well-used features.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Mon 06 Sep 2004 10:37 PM (UTC)
Message
Go for it. :)

However I can't quite understand why using a dialog box is harder than doing something like:

#TRIGGER {You are currently in:} {#T+ Location;#WA 2000;#T- Location}

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #13 on Tue 07 Sep 2004 02:47 PM (UTC)
Message
I am making the plugin, it will be ready in a few. And, Nick, I don't understand it either, but the fact is that you're losing customers to it :p

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #14 on Tue 07 Sep 2004 03:08 PM (UTC)
Message

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, September 07, 2004, 6:06 PM -->
<!-- MuClient version 3.49 -->

<!-- Plugin "Zmud" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Zmud"
   author="Poromenos"
   id="a6cd5dd530cc392b3c69f88f"
   language="VBscript"
   purpose="Allows elements to be added from the command line, Zmud-style."
   date_written="2004-09-07 18:05:51"
   requires="3.49"
   version="1.0"
   >

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   script="sbAddTimer"
   match="^\#TI (\d+) (\d+) (\d+) \{(.*?)\}$"
   enabled="y"
   regexp="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
  <alias
   script="sbAddTrigger"
   match="^\#TRIGGER \{(.*?)\}[ ]+\{(.*?)\}$"
   enabled="y"
   regexp="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
  <alias
   script="sbAddAlias"
   match="^\#ALIAS (.*?) \{(.*?)\}$"
   enabled="y"
   regexp="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
Sub sbAddTrigger(strName, strLine, strWildcards)
    AddTrigger "", strWildcards(1), strWildcards(2), 9, -1, 0, "", ""
    ColourNote "red", "", "Trigger on """ & strWildcards(1) & """ added."
End Sub

Sub sbAddAlias(strName, strLine, strWildcards)
    AddAlias "", strWildcards(1), strWildcards(2), 545, ""
    ColourNote "red", "", "Alias on """ & strWildcards(1) & """ added."
End Sub

Sub sbAddTimer(strName, strLine, strWildcards)
    AddTimer "", Int(strWildcards(1)), Int(strWildcards(2)), Int(strWildcards(3)), strWildcards(4), 1, ""
    ColourNote "red", "", "Timer at """ & Int(strWildcards(1)) & ":" & Int(strWildcards(2)) &  ":" &Int(strWildcards(3)) & """ added."
End Sub


]]>
</script>


</muclient>


Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] 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.


47,230 views.

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

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]