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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Problems With Scripting Variables
Problems With Scripting Variables
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Wed 19 Dec 2001 11:15 AM (UTC) |
Message
| I need help with scripting Variables...
I want it so that when someone says something to me... it'll set alot of Variables containing "stats"
I know how to do that bit.. but I can't figure out the Wildcard to make me say something back to that player straight away...
Also, when they say something else to me, it'll say all of they're "stats"
I know it's a must use VBScripts thing..
I know it can be done, I've seen it done before...
I know it's something like...
Trigger: (player's name) says: Stats
Label: SendStats
Script: SendStats
Sub SendStats
stat = world.GetVariable ("(Player's name)_stat")
world.send "say (Player's name) stat"
end sub
or something along those lines...
Thanx in advance.
~Rhinoa~ | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #1 on Thu 20 Dec 2001 07:08 AM (UTC) |
Message
| Could you cut and paste directly from the MUD output, the lines that you would like to trigger on?
Also, label names and script function/subroutine names must be unique... So where you listed "Label:" and "Script:", the names must be different.
The trigger will automatically pass any wildcards that were accepted to the script subroutine. It's your job to program the script to handle the wildcards, and store them in variables if you would like.
If you gave us the exact output from the MUD, someone here would probably be willing to do it for you.
Try looking at the sample .vbs file that is included with MUSHclient. Look at the mushclient commands that can be used (at http://www.mushclient.com/functions.htm ), and if need be, search Microsoft's site for help with programming in VBS. That's how I learned!
...or, like I've said, post the exact output, and someone here will do it for you. :) |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #2 on Thu 20 Dec 2001 02:16 PM (UTC) Amended on Thu 20 Dec 2001 02:20 PM (UTC) by Storm Dragon
|
Message
| That seems fairly simple
first type:
/world.addtrigger "PlayerStatReq", "* says 'STATS'", "", 1, -1, 0, "", "SendStats"
change this part above as you want > "* says 'STATS'"
then insert this into your VbScript file:
sub SendStats(strTriggerName, trig_line, arrWildCards)
world.send "say " + arrWildCards(1) + " " + world.getvariable (arrWildCards(1) + "_stat")
end sub
This simple sub should do the job as you describe it
| Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #3 on Fri 21 Dec 2001 09:08 AM (UTC) |
Message
| Thanx.. that worked perfectly!
~Rhinoa~ | Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #4 on Fri 21 Dec 2001 08:45 PM (UTC) |
Message
| New problem...
People that aren't registered are saying stats, and getting blank variables...
I need some Scripting that stops this...
I've been experimenting, and have come up with this...
if isempty(arrWildCards (1) & "Name") then
world.send "say " & arrWildCards (1) & " ,you are not currently registered, please say [Join]to me and try again!"
end if
But, for some reason, it doesn't seem to work...
~Rhinoa~ | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #5 on Sat 22 Dec 2001 08:24 AM (UTC) |
Message
| Simply instead of:
world.send "say " + arrWildCards(1) + " " + world.getvariable (arrWildCards(1) + "_stat")
type:
if world.getvariable(arrWildCards(1) + "_stat") then
world.send "say " + arrWildCards(1) + " " + world.getvariable (arrWildCards(1) + "_stat")
else
world.send "say " & arrWildCards (1) & " ,you are not currently registered, please say [Join]to me and try again!"
end if
I think it should work, I am not sure since I have no way of testing it right now. | Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #6 on Sun 23 Dec 2001 02:32 PM (UTC) |
Message
| Thanx again!
Working perfectly...
~Rhinoa~ | Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #7 on Sun 23 Dec 2001 03:49 PM (UTC) |
Message
| Hi again! :)
Not exactly a problem... but I'd like to know how to count how many members I have using VBScript.. (Can't be bothered to count it in the variables) :)
For a change.. I have no idea how to even start this one...
and i don't know if it's even possible...
Hope you can help!
~Rhinoa~ | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #8 on Sun 23 Dec 2001 08:36 PM (UTC) |
Message
| I believe the easiest way is another variable.
though first you have to go through the hard part
of counting every entry you already have.
then insert something in the lines of checking if a person
is already in the list of members and then add 1 to the variable if the person is new.
if world.getvariable(arrwildcards(1) & "_stat") then
world.send "say Hey you, " & arrwildcards(1) & ", stop messing with me, you are already a member!"
else
world.setvariable "StatTotalMembers", world.getvariable("StatTotalMembers") + 1
end if
Above is just an example, use or abuse at will :P
| Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #9 on Mon 24 Dec 2001 11:28 AM (UTC) |
Message
| Thanks! I can't test it just yet... but it makes alot of sense... and I'm sure it'll work!
~Rhinoa~ | Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #10 on Tue 25 Dec 2001 12:51 PM (UTC) |
Message
| New problem..
Some of my variables contain "(Empty)" because they won't be used until that player does certain things...
Now... when someone says "Blah blah slot 1"
It says back all the variables that contain the "(empty)" word... and I don't want it to..
How can I fix this?
I've been experimenting, and have come up with this..
if world.getvariable (arrWildCards (1) & "Slot1") = ("(Empty)") then
world.send "say " & arrWildCards (1) & ", You do not currently have anything in that slot"
else
world.send "say " & arrWildCards (1) & "" & world.getvariable (arrWildCards (1) & "slot1") & ""
end if
But.. of course.. if that worked, I wouldn't be putting it here... | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #11 on Tue 25 Dec 2001 05:55 PM (UTC) |
Message
| if mid(lcase(world.getvariable(arrWildCards(1) & "Slot1")),1,7) = "(empty)" then
world.send "say " & arrWildCards (1) & ", You do not currently have anything in that slot"
else
world.send "say " & arrWildCards (1) & "" & world.getvariable (arrWildCards (1) & "slot1") & ""
end if
Hmm... it did look alright before too, but try the above instead | Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #12 on Tue 25 Dec 2001 08:32 PM (UTC) |
Message
| Thanks! That works lovely! :)
New problem though...
I have Variables containing a "money" stat, and when the player gets enough money.. they can buy potions..
Now, the potions cost 100 each... so the player will say "Buy 5 potions" the potions will be added to the players stats, and the correct amount of money will be removed from the stats.
Now... how can I do this?
Like always, I've been experimenting, and have come up with this:
if world.getvariable (arrWildCards (1) & "Gold") < arrWildCards & (2) * 100 then world.send "say " & arrWildCards & (1) & ", You do not have enough Gold to purchase " & arrWildCards & (2) & " Potions!"
if world.getvariable (arrWildCards & (1) & "Gold")>= arrWildCards & (2) * 100 then world.send "say " & arrWildCards (1) & " " & arrWildCards & (2) & " Potions have been added to your account! " & arrWildCards & (2) * 100 & " Gold has been removed from your account!"
But like always, it doesn't work :)
~Rhinoa~ | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #13 on Wed 26 Dec 2001 10:24 AM (UTC) |
Message
| Before:
if world.getvariable (arrWildCards (1) & "Gold") < arrWildCards & (2) * 100 then world.send "say " & arrWildCards & (1) & ", You do not have enough Gold to purchase " & arrWildCards & (2) & " Potions!"
if world.getvariable (arrWildCards & (1) & "Gold")>= arrWildCards & (2) * 100 then world.send "say " & arrWildCards (1) & " " & arrWildCards & (2) & " Potions have been added to your account! " & arrWildCards & (2) * 100 & " Gold has been removed from your account!"
Wrong : arrWildCards & (1)
Right : arrWildcards(1)
you made those errors throughout most of the lines.
Now:
if world.getvariable (arrWildCards(1) & "Gold") < arrWildCards(2) * 100 then
world.send "say " & arrWildCards(1) & ", You do not have enough Gold to purchase " & arrWildCards(2) & " Potions!"
end if
if world.getvariable (arrWildCards(1) & "Gold") >= arrWildCards(2) * 100 then
world.send "say " & arrWildCards(1) & " " & arrWildCards(2) & " Potions have been added to your account! " & arrWildCards(2) * 100 & " Gold has been removed from your account!"
end if
Ok.. when writing your own code remember to make it look nice, I can understand it better if it is not cluttered up
split the lines, I know there is a character in VB to notify it to split a line in two, I cant remember it now though | Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #14 on Wed 26 Dec 2001 12:14 PM (UTC) |
Message
| Thanx, that works nicely..
and sorry about the last code... I was in a rush and wasn't thinking about I was typing =(
~Rhinoa~ | 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.
62,219 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top