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, 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 ➜ VBscript ➜ Scripting help

Scripting help

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


Posted by Daraquir   (5 posts)  Bio
Date Wed 15 Jan 2003 02:23 PM (UTC)
Message
Greetings, I've been reading alot of treads, noone seemed specific enough for my problems and i'm new to VBscripts
and scripts in general especielly variables, but ill go right to the point...

I need a script that's.. ill split it up into steps

Just want to create something simple..

First i want to use a alias, to save the A and B, for
further use..

1, create A B

second i want to send a command, then runs the next
script..

2, say I just created A

then i have to wait awhile to recover from the
effect, But it could be interupted, so i would prefer
a matching text instead of a delay timer, then
continues the script..

3, match C

Here i just want to match A from a list, A,X,Y,P
example then load that variable and sends a value
to the world..

4, match A, send new value to world

And here's the final part..
Want to copy B, like a wildcard and insert it and
send the command to world..

5, copy B, send to world: say Look so cute B are

I'm hoping this will go as fast as poisble millie
secounds, couse it's realy importent with the
syncronising with step 4, 5

If you got any suggestion's in how i can make it easier or better, feel free to share your thoughts.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 15 Jan 2003 10:59 PM (UTC)
Message
Can you clarify what A and B are? Are they things on the MUD? Variables? Something in MUSHclient like triggers?

Can you give an example of what you would expect to see?

You say "then i have to wait awhile to recover from the
effect" ... what affect? How do you know when you have recovered?

It is hard to suggest a script without knowing what you are trying to do.

- Nick Gammon

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

Posted by Daraquir   (5 posts)  Bio
Date Reply #2 on Thu 16 Jan 2003 01:45 AM (UTC)
Message
Oops, sorry didn't give detailed explaination enough, a, b
is just something to send to the world.

I just wanted to find out the codes, so i can type in the
rest myself.. but ill explain deeper then...

(Using * * as wildcards, easier to explain with it..)

1, Want to set up a alias, that's 1 * *
2, send to world "secrete %1" goto step 3
Then i want a matching trigger to wait until i have recovered.
3 "You have recovered balance on all limbs." - goto step 4
Then i want to recall %1 and load that value that was in a list, example, create an illusion, of the a diffrent venom in the list, "illusion
4, if %1 = sumac send sumac(in lisT) to world goto step 5
(list)
sumac value send to world, "conjure illusion Daraquir has biten you with sumac, you feel the aching spread within your body."
xentio.. same thing here but with another illusion/venom.

5, bite %2

the whole tecnique is that i want to decress the number of aliases i use, drasticly, what i need to do in the mud is first secrete the venom, then wait for balance, then conjure an illusion, and bite the victim at the same time with the poison i secreted... ill hope that makes some sense..
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #3 on Thu 16 Jan 2003 04:54 PM (UTC)
Message
If I understood you correctly then here's what you want...

You want to use an alias that passes two wildcards,
the first of which (A) is the venom you want to secrete
and bite with, and the second one (B) is the one you want to illusion before the actual bite.

Then you want to have a list of illusion messages for
each venom, from which you can choose a message by
matching it against (B) and send it to the world along
with illusion syntax ("conjure illusion")

In other words, what I understood, comes down to:

a) (alias 'bite * *') do -> bite sumac xentio
b) secrete sumac
c) wait for balance recovery
d) illusion xentio; bite sumac

Or is %2 in that alias the name of your target? It's still a bit confusing the way it is now, sorry.

I might have it all wrong here and the following is hence utterly useless, but I decided to propose a solution to the problem, as I undestand it, anyway.

Here's the proposed solution. You'll need to copy and paste the aliases, triggers and scripts into your world file and main script file, as well as make sure that no already existing aliases and, more importantly, triggers will get in the way of the new ones. Also, as this was written in the space of 10 minutes on my lap, and the only connection I have to Snakes in Achaea is being robbed by them
regularly, you'll need to make sure the command syntax is consistent and that it generally does what you want it to.

<alias name="BiteIllusion" enabled="y" match="bite * *" script="SelectBiteIllusion" />

<trigger
name="BalanceRecovered"
match="*You have recovered balance on all limbs."
script="DoBiteIllusion"
enabled="n"
sequence="100"
>
</trigger>

Here's the script to make it all work:

'---> These are the variables you'll need, first 3 are
' processed completely in the provided script
' but 'targetVar' is whatever variable you use for your
' target, so replace it with your own in sub
' DoBiteIllusion (and delete it from the declaration if
' it is declared elsewhere already).

dim venomMessage, illusionMessage, secreteVenom, targetVar

'----> This populates the 2 arrays - venomMessage and
' secreteVenom - for storing illusion messages of
' various venoms and names of those venoms,
' respectively. You should specify this sub in Events
' (or whatever it is called)
' under Scripting in World Properties, to be run when
' you open your world. Also fill in the missing
' declarations, venom names and messages


sub OnWorldOpen
venomMessage(1) = "Venom1 message here."
venomMessage(2) = "Venom2 message here."
....
venomMessage(N) = "VenomN message here."

secreteVenom(1) = "sumac"
secreteVenom(2) = "aconite"
...
secreteVenom(N) = "gecko"
end sub


'--->From here you can go by the numbers, just remember
' what venom has what number and use those numbers in
' the SelectBiteIllusion alias. %1 in alias defines what
' venom will be secreted, %2 - what venom will be
' illusioned.


sub SelectBiteIllusion (name, output, wildcs)
dim indxIllusion, indxVenom
indxIllusion = cint(wildcs(2))
indxVenom = cint(wildcs(1))

illusionMessage = "conjure illusion " & venomMessage(indxIllusion)
world.send "secrete " & secreteVenom(indxVenom)
world.enabletrigger "BalanceRecovered", TRUE

end sub



sub DoBiteIllusion (name, output, wildcs)

world.send IllusionMessage
world.send "bite " & targetVar
world.enabletrigger "BalanceRecovered", FALSE

end




P.S. If this is not what you actually need, specify the problem in more detail.
I guess it could all be put into a plugin, but I am too lazy to write one from start to finish right now.
Top

Posted by Daraquir   (5 posts)  Bio
Date Reply #4 on Fri 17 Jan 2003 12:10 AM (UTC)
Message
Hmm, It was not quite so i meant, but i think the idea was
better then mine, it was target i meant in %2, but if i can get a target system, that would work better.. But i wont ask for that now, becouse i want the script to work first..
I got an error when i executed the script, it said

Event: Execution of line 15 column 1
Description: Inkompatibla typer: 'cint'
Called by: Function/Sub: selectbiteillusion called by alias
Reason: processing alias ""

when i looked it up, it was just the "end sub" before
selectbiteillusion

I've created a alias 1 * * and launched the script, then
when i got that message..
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #5 on Fri 17 Jan 2003 09:17 PM (UTC)
Message
Hmm, unless I am doing something wrong (which is very much possible), you are trying to pass something
other than numbers in that '1 * *' alias. That's the only explanation for the error I can think of right now.
The correct way to use that alias is: 1 1 2, i.e

If you try to do something like: 1 sumac xentio, it'll give you an error since SelectBiteIllusion expects 2 numbers
as wildcards, which it can convert to integers to be used as array indexes later on.
If using the numbers as wildcards still gives you that error... Hmm, then try commenting out the

indxIllusion = cint(wildcs(2))
indxVenom = cint(wildcs(1))

lines in the SelectBiteIllusion sub, maybe that'll solve the problem - VBscript is very confusing at times.

Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Sat 18 Jan 2003 05:51 AM (UTC)
Message
Quote:

Then i want to recall %1 and load that value that was in a list, example, create an illusion, of the a diffrent venom in the list, "illusion


In an alias if you want to remember a variable like that you need to call a script and use world.setvariable to do that. eg.

world.setvariable "spell", wildcards (1)

Then you can access that variable later on in a trigger.

- Nick Gammon

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

Posted by Daraquir   (5 posts)  Bio
Date Reply #7 on Sun 19 Jan 2003 09:19 AM (UTC)
Message
Hmm, I don't realy get it to work, Could you aid me abit
more where i could insert the setvariable, and could
use ked's system in it, and what could i change.

Like I said I'm abit new to scripting in this code.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Sun 19 Jan 2003 10:31 AM (UTC)

Amended on Sun 19 Jan 2003 10:32 AM (UTC) by Nick Gammon

Message
Post what you have done, it is hard to guess what is wrong.

Try searching this forum for "setvariable" - there are quite a few examples.

- Nick Gammon

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

Posted by Daraquir   (5 posts)  Bio
Date Reply #9 on Tue 21 Jan 2003 06:09 AM (UTC)
Message
This is what i've done so far and what i'm stuck at,
I'm not completly sure abot's ked's system what to type in
variables and what to type in script.

this is what i got in script:

sub OnWorldOpen
venomMessage(1) = "conjure illusion Sumac"
venomMessage(2) = "conjure illusion Xentio"
venomMessage(N) = "conjure illusion Curare"

secreteVenom(1) = "sumac"
secreteVenom(2) = "xentio"
secreteVenom(N) = "curare"
end sub

sub SelectBiteIllusion (name, output, wildcs)
dim indxIllusion, indxVenom
indxIllusion = cint(wildcs(2))
indxVenom = cint(wildcs(1))

illusionMessage = "conjure illusion " & venomMessage(indxIllusion)
world.send "secrete " & secreteVenom(indxVenom)
world.enabletrigger "BalanceRecovered", TRUE

end sub

sub DoBiteIllusion (name, output, wildcs)

world.send IllusionMessage
world.send "bite " & targetVar
world.enabletrigger "BalanceRecovered", FALSE

end sub

trigger:

</trigger>
<trigger
match="*You have recovered balance on all limbs."
name="BalanceRecovered"
script="DoBiteIllusion"
sequence="100"
>
</trigger>

alias:
<alias
script="selectbiteillusion"
match="1 * *"
enabled="y"
>
</alias>


I dont have anything in variable yet, trying to figure out
what to type in it. Thanks for helping me by the way.
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.


27,269 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.