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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Need a script for space travel in a swr mud
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Need a script for space travel in a swr mud

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


Posted by Madrox   (40 posts)  [Biography] bio
Date Sun 11 Dec 2005 02:41 PM (UTC)
Message
Hi, not sure if this is how i go about it but I need a script to search uncharted space in a swr mud. Basicly I want to put in two sets of coords into the script ie '100 100' and '200 200' and have it search everywhere in between one by one. The commands would be "Calc 'x y'" then the out put would be
"The ship lurches slightly as it comes out of hyperspace."
After that message id like it to move on to the next sector. If possible id like it to go from '100 100' to '100 101' then '100 102' and so on. And when it reaches 100 200 it would roll over to 101 100 and so on again. If anyone could help me out that would be wonderful. Thanks a lot in advance
[Go to top] top

Posted by Madrox   (40 posts)  [Biography] bio
Date Reply #1 on Sun 11 Dec 2005 08:05 PM (UTC)
Message
Also, if no one is able to write one for me. Could someone direct me to a site that would teach me how to write the script. I looked over a script that Flannel wrote for the same mud, but it all looks like jibberish to me. So any guideance would be very nice. Thanks.
[Go to top] top

Posted by Madrox   (40 posts)  [Biography] bio
Date Reply #2 on Sun 11 Dec 2005 08:54 PM (UTC)
Message
Alright, I tried using the example scripts posted on this site. But it says "You have not specified a file name:
The Alias (OnTeleport)subroutine "OnTeleport" could not be found"

So I dont know what i did wrong any suggestions *sigh* its been a long day heh
[Go to top] top

Posted by Madrox   (40 posts)  [Biography] bio
Date Reply #3 on Mon 12 Dec 2005 01:43 PM (UTC)
Message
Alright, after thinking about the problem for a while, ive figured out I can do it with triggers. But I dont know the syntax. It would be something like. (match this)
The ship lurches slightly as it comes out of hyperspace.
then send NAV then the read out from NAV is like.
Readout for BR-23 Public Transport BC120:
---------------------------------------------------------
Current Coordinates: 3338 -6445 -9670
Current Heading: 1 1 -1
Current Speed: 75/75
--Location-----------------------------------------------
Current System: Roche Sector
Current System X/Y: (-55, -6)
--Hyperspace---------------------------------------------
(No hyperspace trajectory is locked right now)

But i only need the Current System X/Y: (-55, -6)
from there I would do either +1 or -1 and there is my problem. How do I tell the trigger to add one to a number it would be like Current System X/Y: (*, *)
calc '%1 %2+1' or minus if i want to go backwards, anyway any ideas?
[Go to top] top

Posted by Madrox   (40 posts)  [Biography] bio
Date Reply #4 on Mon 12 Dec 2005 02:12 PM (UTC)

Amended on Mon 12 Dec 2005 02:29 PM (UTC) by Madrox

Message
Alright, I figured it out i think, I have a trigger matching

^Current System X\/Y\: \((.*?)\, (.*?)\)$
then I send to a script this...

Here is what I have:
dim num
num = ("%2") + 1
send "calc '%1 getvariable("num")'

and i get an error that says Expected end of statement
Line in error:
send "calc '-55 getvariable("num")'

When its all said and done I want it to send
calc '%1 NUM'
any ideas?
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #5 on Mon 12 Dec 2005 05:13 PM (UTC)

Amended on Mon 12 Dec 2005 05:14 PM (UTC) by Shadowfyr

Message
Well, you seem to be confused about how variables work here for one:

dim num
num = ("%2") + 1

creates a *script* variable. Setvariable and getvariable are used with *Mushclient* variables, which is one reason why:

send "calc '%1 getvariable("num")'

won't work. The other reason is that this is *not* correct VBScript syntax. You left off the final ", and getvarialble, even if it worked, can't happen 'inside' the send command. This would be correct:

setvariable "num", "%2"
send "calc '%1 " & getvariable("num") & "'"
[Go to top] top

Posted by Madrox   (40 posts)  [Biography] bio
Date Reply #6 on Mon 12 Dec 2005 07:35 PM (UTC)

Amended on Mon 12 Dec 2005 08:13 PM (UTC) by Madrox

Message
Wow, im a dumb ass noob :P Well I took your trigger and just added
setvariable "num", "%2" + 1
send "calc '%1 " & getvariable("num") & "'"

and it works perfectly! thanks a bunch for your help
[Go to top] top

Posted by Madrox   (40 posts)  [Biography] bio
Date Reply #7 on Tue 13 Dec 2005 02:17 AM (UTC)
Message
Alright, I got a script but for some reason the triggers dont work :/ any suggestions?

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE muclient (View Source for full doctype...)>
- <!-- Saved on Monday, December 12, 2005, 7:00 PM
-->
- <!-- MuClient version 3.70
-->
- <!-- Plugin "systemsearch" generated by Plugin Wizard
-->
- <muclient>
- <plugin name="systemsearch" author="Rojan QDel" id="4e6527d4dd49421b577e993b" language="VBscript" purpose="Search for starsystems in LOTJ" save_state="y" date_written="2005-12-12 18:59:46" requires="3.65" version="1.0">
- <description trim="y">
- <![CDATA[
Made by Rojan QDel
rojanqdel@verizon.net
AIM: RojanQDel


]]>
</description>
</plugin>
- <!-- Get our standard constants
-->
<include name="constants.vbs" />
- <!-- Triggers
-->
- <triggers>
<trigger enabled="y" group="search" match="Hyperjump complete." name="search" script="completejump" sequence="100" />
</triggers>
- <!-- Aliases
-->
- <aliases>
<alias script="startsearch" match="startsearch" enabled="y" group="search" sequence="100" />
<alias script="stopsearch" match="stopsearch" enabled="y" group="search" sequence="100" />
<alias name="setfirst" script="setfirst" match="setfirst * *" enabled="y" group="search" sequence="100" />
<alias name="setsecond" script="setsecond" match="setsecond * *" enabled="y" group="search" sequence="100" />
</aliases>
- <!-- Variables
-->
- <variables>
<variable name="x1">0</variable>
<variable name="x2">0</variable>
<variable name="y1">0</variable>
<variable name="y2">0</variable>
<variable name="x1o">0</variable>
<variable name="y1o">0</variable>
</variables>
- <!-- Script
-->
- <script>
- <![CDATA[
Dim x1
Dim x1o
Dim x2
Dim y1
Dim y1o
Dim y2

Sub completejump(Thename, theoutput, thewildcards)
world.send "look"
world.send "navstat"
x1=world.getvariable ("x1")
x1o=world.getvariable ("x1o")
x2=world.getvariable ("x2")
y1=world.getvariable ("y1")
y1o=world.getvariable ("y1o")
y2=world.getvariable ("y2")
If x1 = x1o Then
Call searchy
else
Call searchx
End If
End Sub

Sub setfirst(Thename, theoutput, thewildcards)
x1o = GetAliasWildcard ("setfirst", "1")
world.setvariable "x1o", x1o
world.setvariable "x1", x1
y1o = GetAliasWildcard ("setfirst", "2")
world.setvariable "y1o", y1o
world.setvariable "y1", y1
world.note "Starting coordinates are: '" & x1o & " " & y1o & "'"
End Sub

Sub setsecond(Thename, theoutput, thewildcards)
x2 = GetAliasWildcard ("setsecond", "1")
world.setvariable "x2", x2
y2 = GetAliasWildcard ("setsecond", "2")
world.setvariable "y2", y2
world.note "Ending coordinates are: '" & x2 & " " & y2 & "'"
End Sub

Sub startsearch (Thename, theoutput, thewildcards)
world.EnableTriggerGroup "search", 1
world.note "Enabled Search Triggers!"
Call searchx
End Sub

Sub searchx ()
x1=world.getvariable ("x1")
x1o=world.getvariable ("x1o")
x2=world.getvariable ("x2")
y1=world.getvariable ("y1")
y1o=world.getvariable ("y1o")
y2=world.getvariable ("y2")
If x1 <> x2 Then
If x1 < 0 Then
x1 = x1 - 1
Else
x1 = x1 + 1
End if
world.setvariable "x1", x1
world.send "calc '" & x1 & " " & y1o & "'"
Else
x1 = x1o
world.setvariable "x1", x1
Call searchy
End If
End Sub

Sub searchy ()
x1=world.getvariable ("x1")
x1o=world.getvariable ("x1o")
x2=world.getvariable ("x2")
y1=world.getvariable ("y1")
y1o=world.getvariable ("y1o")
y2=world.getvariable ("y2")
If y1 <> y2 Then
If y1 < 0 Then
y1 = y1 - 1
Else
y1 = y1 + 1
End if
world.setvariable "y1", y1
world.send "calc '" & x1o & " " & y1 & "'"
Else
Call stopsearchs
End If
End Sub

Sub stopsearch (Thename, theoutput, thewildcards)
world.EnableTriggerGroup "search", 0
world.note "Disabled Search Triggers!"
End Sub

Sub stopsearchs ()
world.EnableTriggerGroup "search", 0
world.note "Disabled Search Triggers!"
End Sub


]]>
</script>
- <!-- Plugin help
-->
- <aliases>
<alias script="OnHelp" match="systemsearch:help" enabled="y" />
</aliases>
- <script>
- <![CDATA[
Sub OnHelp (sName, sLine, wildcards)
world.Note world.GetPluginInfo (world.GetPluginID, 3)
End Sub


]]>
</script>
</muclient>
[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.


6,438 views.

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 FutureQuest]