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
VBscript
Achaea/Aetolia
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Pages: 1 2
Posted by
| Michael Kennedy
(11 posts) bio
|
Date
| Fri 26 Sep 2003 09:05 AM (UTC) Amended on Fri 26 Sep 2003 09:15 AM (UTC) by Michael Kennedy
|
Message
| I play Aetolia and want to create a very indepth combat system. To do the things I would like I need to write a script. Its been so long since i've done any programming and remember next to none. If anyone has a combat system of some sorts I could use for a refrence it would be great. One of the things I would like it to do is if this happens, reel as your mind is battered by a mental assault from * eat a goldenseal wait till the herb timer is up then eat another goldenseal wait again for the herb timer to end then eat a lobelia. While this is going on keep track of any other afflictions that happen and wait till the next time its able to be cured before trying to cure it. If anyone could help me this I would be in your debt.
Thanks,
Michael
p.s.
Oh yea, it would also need to keep track of things after its cured so it don't try and cure them more then once. Till that affliction happens again. | top |
|
Posted by
| Nick Gammon
Australia (23,045 posts) bio
Forum Administrator |
Date
| Reply #1 on Fri 26 Sep 2003 11:13 PM (UTC) |
Message
| Have a bit of a search of this forum. There are quite a few postings by people who have made scripts react to things like that. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Bobble
Canada (76 posts) bio
|
Date
| Reply #2 on Thu 16 Oct 2003 04:16 PM (UTC) Amended on Fri 09 Jul 2004 06:53 PM (UTC) by Bobble
|
Message
| Hey Michael,
I play (or did play) Aetolia. I've managed to come up with a decent system for handling and tracking afflictions using MC. But before getting into any of it, I thought I'd leave a message here and see if you're still around. That way I don't post all sorts of stuff to someone who's not here anymore.
BTW, what's your character name? |
Open the watch. | top |
|
Posted by
| Michael Kennedy
(11 posts) bio
|
Date
| Reply #3 on Thu 16 Oct 2003 06:20 PM (UTC) |
Message
| Yea I still play and its Cass. I've resently bought a rather large in depth book on vbscript, and have been reading over it. Would still be great to have some refrences to look over to help get me started. | top |
|
Posted by
| Bobble
Canada (76 posts) bio
|
Date
| Reply #4 on Thu 16 Oct 2003 11:19 PM (UTC) |
Message
| Okie,
To start off with, you'll need to create a variable for each affliction. I call them affliction_X where X is the name of the affliction ie. affliction_paralysis. (There's a point to putting affliction_ in front of each one, so don't just use paralysis, asthma, etc.)
Then you'll need to create a set of triggers for each affliction. You'll need the trigger that lets you know you have the affliction and a trigger that tells you that the affliction has been cured. So for masochism you have these triggers (as regular expressions):
An odd sensation descends upon you\.$
You feel the urge to slash\, cut\, and bruise yourself\.$
With the heel of your palm\, you smack.+$
You drive a clenched fist into your gut\.$
You use your (right|left) foot to stomp on your (left|right) as hard as possible\.$
Each of these call the subroutine masochismon:
Sub masochismon (a, b, c)
world.setvariable "affliction_masochism", "on" 'this sets the variable to on
anorexia = world.getvariable ("affliction_anorexia") 'this section stops the trigger from trying to eat if you have anorexia
If anorexia = "off" Then
world.sendpush "eat lobelia"
End If
end Sub
Then you also have the trigger for turning masochism off:
You no longer enjoy pain\.$
This calls the subroutine masochismoff:
Sub masochismoff (a, b, c)
world.setvariable "affliction_masochism", "off"
End Sub
This is the first step. The next is designing the part that eats when you get herb balance back. I'll get to that soon, but I gotta run. |
Open the watch. | top |
|
Posted by
| Ked
Russia (524 posts) bio
|
Date
| Reply #5 on Fri 17 Oct 2003 02:38 AM (UTC) |
Message
| The best reference for Vbscript that I've ever seen is, surprisingly enough, Microsoft's scripting documentation download. That's a help volume that includes a tutorial and reference for Vbscript, as well as the same section for Jscript, and plenty of information on Windows Script Host in general. If you want to use vbscript in MC I suggest you download that first of all from http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
| top |
|
Posted by
| Bobble
Canada (76 posts) bio
|
Date
| Reply #6 on Fri 17 Oct 2003 12:13 PM (UTC) Amended on Fri 17 Oct 2003 12:44 PM (UTC) by Bobble
|
Message
| Oooh, good reference Ked!
I also use http://www.devguru.com/technologies/vbscript/quickref/vbscript_intro.html.
Now, on to the next part for the healing system. After you've created subroutines that turn each variable for the appropriate affliction off and on, you need a subroutine that's called each time you get the trigger:
You may eat another plant\.$
Here's my sub:
Sub herbhealing (a, b, c)
Dim value, spell, anorexia, scytherus
anorexia = world.getvariable ("affliction_anorexia")
scytherus = world.getvariable ("affliction_scytherus")
If scytherus = "on" Then
world.sendpush "eat ginseng"
End If
If anorexia = "on" Then
Exit Sub
End If
For Each v In world.GetVariableList
value = world.GetVariable (v)
If Left (v, 11) = "affliction_" Then
spell = Mid (v, 12)
If value = "on" Then
Select Case spell
Case "stupidity" world.sendpush "eat goldenseal"
Case "slickness" world.sendpush "eat bloodroot"
Case "paralysis" world.sendpush "eat bloodroot"
Case "confusion" world.sendpush "eat ash"
Case "scytherus" world.sendpush "eat ginseng"
case "epilepsy" world.sendpush "eat goldenseal"
case "masochism" world.sendpush "eat lobelia"
Case "dizziness" world.sendpush "eat goldenseal"
Case "recklessness" world.sendpush "eat lobelia"
Case "heroism" world.sendpush "eat lobelia"
Case "justice" world.sendpush "eat bellwort"
Case "paranoia" world.sendpush "eat ash"
case "shyness" world.sendpush "eat lobelia"
case "hallucinations" world.sendpush "eat ash"
case "generosity" world.sendpush "eat bellwort"
case "loneliness" world.sendpush "eat lobelia"
case "impatience" world.sendpush "eat goldenseal"
case "claustrophobia" world.sendpush "eat lobelia"
case "vertigo" world.sendpush "eat lobelia"
case "beserk" world.sendpush "eat lobelia"
Case "dementia" world.sendpush "eat ash"
case "clumsiness" world.sendpush "eat kelp"
case "agoraphobia" world.sendpush "eat lobelia"
case "mercy" world.sendpush "eat bellwort"
case "hypersomnia" world.sendpush "eat ash"
case "darkshade" world.sendpush "eat ginseng"
case "peace" world.sendpush "eat bellwort"
case "asthma" world.sendpush "eat kelp"
Case "vomiting" world.sendpush "eat ginseng"
Case "haemophilia" world.sendpush "eat ginseng"
Case "weakness" world.sendpush "eat kelp"
Case "stuttering" world.sendpush "eat goldenseal"
Case "lovers" world.sendpush "eat bellwort"
Case "deafness" world.sendpush "eat hawthorn"
Case "blindenss" world.sendpush "eat bayberry"
End Select
Exit Sub
End If
End If
Next
end Sub
Let me know if you have any questions about what I've done here. The reason the scytherus cure is separated from the rest is just a peculiarity for me. It helps in fighting snakes, but that's something we don't need to get into right now. Take a look and let me know what you think
The one thing about this system is that you will eat a lot of herbs. But I think it works better this way. |
Open the watch. | top |
|
Posted by
| Michael Kennedy
(11 posts) bio
|
Date
| Reply #7 on Fri 17 Oct 2003 08:53 PM (UTC) Amended on Fri 17 Oct 2003 08:57 PM (UTC) by Michael Kennedy
|
Message
| Thanks alot, this is really starting to bring back some memories. Hopefuly I can get this script done in about a weak to how I want it. Oh, and as for refrences I just bought this 800 page book on vbscript alone which seems to be pretty good so far.
| top |
|
Posted by
| Michael Kennedy
(11 posts) bio
|
Date
| Reply #8 on Mon 03 Nov 2003 09:25 AM (UTC) Amended on Mon 03 Nov 2003 09:56 AM (UTC) by Michael Kennedy
|
Message
| Ok could someone go over this for me please?
Dim Affliction_Stupidity
Dim herbtimer
Dim Affliction_Food
Dim TryAgain
Sub Stupidityon
Do
TryAgain = "no"
world.setvariable "Affliction_Stupidity", "on"
herbtimer = world.getvariable ("herbtimer")
food = world.getvariable ("affliction_food")
If herbtimer = "on" Then
TryAgain = "yes"
Else
If food = "off" Then
world.sendpush "outb goldenseal"
world.sendpush "eat goldenseal"
TryAgain = "no"
Else
TryAgain = "yes"
End If
Loop while TryAgain = "yes"
End Sub
Sub Stupidityoff
world.setvariable "Affliction_Stupidity", "off"
End Sub
Triggers are: Your mind feels suddenly dulled and slow
group: afflictions_stupidity script: Stupidityon
there are also a few other different triggers with the same group and script then finally there is one You aren’t such a complete idiot anymore.
same group but script is stupidityoff
If all that looks good i can't figure out how i would set up the herbtimer would that be in its own sub or a different sub i'll be using it in many other subs as well | top |
|
Posted by
| Michael Kennedy
(11 posts) bio
|
Date
| Reply #9 on Mon 03 Nov 2003 12:01 PM (UTC) |
Message
| Ok heres what I got so far, but its giving me the wrong number of arguments for script subroutine error when I try to test my trigger.
Dim Affliction_Stupidity
Dim herbtimer
Dim Affliction_Food
Dim TryAgain
Dim elixertimer
Sub elixertimeron
world.setvariable "elixertimer", "on"
End Sub
Sub elixertimeroff
world.setvariable "elixertimer", "off"
End Sub
Sub herbtimeron
world.setvariable "herbtimer", "on"
End Sub
Sub herbtimeroff
world.setvariable "herbtimer", "off"
End sub
Sub Foodon
Do
TryAgain = "no"
World.setVariable "Affliction_food", "on"
If elixertimer = "on" Then
TryAgain = "Yes"
Else
world.sendpush "apply epidermal"
TryAgain = "no"
End If
Loop while TryAgain = "yes"
End Sub
Sub Foodoff
world.setvariable "Affliction_food", "off"
End Sub
Sub Stupidityon
Do
TryAgain = "no"
world.setvariable "Affliction_Stupidity", "on"
herbtimer = world.getvariable ("herbtimer")
food = world.getvariable ("affliction_food")
If herbtimer = "on" Then
TryAgain = "yes"
End if
If food = "off" Then
world.sendpush "outb goldenseal"
world.sendpush "eat goldenseal"
TryAgain = "no"
End If
Loop while TryAgain = "yes"
End Sub
Sub Stupidityoff
world.setvariable "Affliction_Stupidity", "off"
End Sub | top |
|
Posted by
| Ked
Russia (524 posts) bio
|
Date
| Reply #10 on Tue 04 Nov 2003 01:54 AM (UTC) |
Message
| Immediate response to your problem is obvious: the Stupidityon sub doesn't expect any arguments while it is obviously being called by a trigger. The error you recieve is due to the fact that triggers and aliases pass 3 arguments to the script routines they call, in respective order these arguments are:
1. Trigger/alias name
2. what is in its Send field
3. any captured wildcards as an array
So, first of all, go through your script and make sure that all subs that are called by triggers/aliases except 3 arguments. For example:
sub Stupidityon (name, output, wildcs)
...
end sub
It is needed to note that timers pass only one value to scripts (their name), so a timer-invoked sub would look like:
sub TimerSub (name)
...
end sub
I don't give any guarantees that the above will solve all your problems, since I didn't pay much attention to the script, but it should solve the particular one you have posted about, and that's already a start.
| top |
|
Posted by
| Nick Gammon
Australia (23,045 posts) bio
Forum Administrator |
Date
| Reply #11 on Tue 04 Nov 2003 04:21 AM (UTC) |
Message
| Ked is quite right, however an alternative approach would be to call the StupidityOn sub directly from the trigger (or alias or whatever) by doing something like:
call StupidityOn
In the trigger "send" text and set the trigger to "send to script". That executes the send text as a script, which should then find you sub in your script file. Do this *instead* of putting StupidityOn as the script name.
Another approach again is to do away with the script file and just do whatever it is you are doing in the sub directly in the trigger/alias/timer by simply putting the entire code in the "send" box and sending it all to script.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Michael Kennedy
(11 posts) bio
|
Date
| Reply #12 on Tue 04 Nov 2003 10:49 AM (UTC) |
Message
| Ok, I got it to work, but it didn't work how I would like it too. Would like to exit the sub if herbtimer is on as well as if food is on but can't seem to word it right. Thanks again for all the help I know i'm a pain=x
Sub Stupidityon (name, output, wildcards)
Do
Affliction_Stupidity = "off"
world.setvariable "Affliction_Stupidity", "on"
herbtimer = world.getvariable ("herbtimer")
food = world.getvariable ("affliction_food")
If herbtimer = "on" Then
Exit Sub
Or food = "off" Then
world.sendpush "outb goldenseal"
world.sendpush "eat goldenseal"
Affliction_Stupidity = "on"
End If
Loop while Affliction_Stupidity = "on"
End Sub
| top |
|
Posted by
| Ked
Russia (524 posts) bio
|
Date
| Reply #13 on Tue 04 Nov 2003 04:09 PM (UTC) |
Message
| Here's how to do that:
Sub Stupidityon (name, output, wildcards)
Do
Affliction_Stupidity = "off"
world.setvariable "Affliction_Stupidity", "on"
herbtimer = world.getvariable ("herbtimer")
food = world.getvariable ("affliction_food")
If (herbtimer = "on") or (food = "on") then
Exit Sub
end if
world.sendpush "outb goldenseal"
world.sendpush "eat goldenseal"
Affliction_Stupidity = "on"
Loop while Affliction_Stupidity = "on"
End Sub
If I understood you correctly then you want to exit the sub if either herbtimer or food are "on", that's what the above does. | top |
|
Posted by
| Michael Kennedy
(11 posts) bio
|
Date
| Reply #14 on Tue 04 Nov 2003 07:28 PM (UTC) |
Message
| Yes thats some what right but affliction_stupidity would be off after you eat the goldenseal. I would want it too loop while its still on but you can't eat another herb if you have already eatten one recently or if you have the affliction_food as i titled it in effect. So I would want it to loop back around if either of those are true | 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,640 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