You can download this script (the script file is called TramWarps.txt): click here
[Head]
Type=Script
Version=2.0
[Settings]
Origin=0.000n 0.000w 0.00a 0.0°
[Script]
###################################
# The DoubleWarps Bot #
# a Xelagot script #
# (c) 1999 Alex Grigny de Castro #
###################################
# (second version)
# I made this script to build the warps in my two-way tramlines on Mars
# I hate calculating them, that's a bot's job!
# This script uses one sided panels, on Mars that is sign4.rwx
# and creates warps using a pair of these, back to back,
# warping in opposite directions.
# Put the bot with its feet where you need the first warp
# (on Mars, that is 6m above the base of trama.rwx)
# facing in the direction it is going to build the warps.
# You can use verbal commands to position the bot,
# together with another script: avatar_object_click.txt
# which you will find in your script directory.# Then load this script,
# verbally adjust the distance between the warps, the model
# and the number of warps ('repeat') and put the bot to work.
# By default, it puts one double warp model sign4.rwx, with a range of 10m
# (it adds 2m for the warp to work smoothly).
# It has a menu, just follow the instructions the bot gives you :)
# If you only need to know the action field, ask the bot (say 'action')
# Note on second version:
# on Mars, the sign4.rwx I use faces the 'wrong' way when created by the bot
# i.e. it faces away from the bot, so it is invisible, non-solid
# and un-bumpable from that side. In AW the pp17.rwx faces the right way
# i.e. faces the bot and is visible, solid and bumpable from that side.
# If the action field does not correspond
# to the way the object faces when created,
# the warps will push you back instead of forwards.
# You can change the way the bot handles the object
# by saying 'faces you' for an AlphaWorld pp17.rwx (%faces = 1),
# or 'faces away' for a Martian sign4.rwx (%faces = 0)
# By default, the bot uses sign4.rwx and 'faces away'
var @bot, %alpha, %beta, %ns1, %we1, %ns2, %we2
var $ns1, $we1, $ns2, $we2, $ac1, $ac2
var ~w1, ~w2
var %dist, %ds, %repeat, %re, %done
var $panel, %faces
# distance between 2 warps in meters
# 2 meters will be added to the warp
%dist = 10
# panel must be a one sided panel
$panel = "sign4.rwx"
# repeat times
%repeat = 1
%faces = 0
Add %ds %dist 2
Div %ds %ds 10
Stop
Gosub SayState
Gosub SayHelp
Label Wait
OnChatEvent Chat
Label WaitLoop
Goto WaitLoop
Label Build
OnChatEvent
%re = %repeat
%done = 0
Add %ds %dist 2
Div %ds %ds 10
# %ds has the distance of the warp in aw units
Label BuildNow
Gosub Pos
GetLocation @bot
LocMove3d @bot %dist 0 0
WarpLocal @bot
Dec %re
Inc %done
Concat $a "Warp " %done
Say $a
IfInt %re > 0 Goto BuildNow
Say Done
Goto Wait
End
Sub Pos
GetRotation %alpha
Add %beta %alpha 180
# %alpha is bot rotation in degrees
# %beta is the opposite direction
# backward warp
Cos %c %beta
Sin %d %beta
Mul %ns1 %ds %c
Mul %we1 %ds %d
StringFromReal $ns1 %ns1 2
IfString "-" IsIn $ns1
Else Concat $ns1 "+" $ns1
StringFromReal $we1 %we1 2
IfString "-" IsIn $we1
Else Concat $we1 "+" $we1
Concat $ac1 "create visible off;bump warp " $ns1 " " $we1
GetPosition ~w1
GetModel ~w1 $panel
GetAction ~w1 $ac1
GetCitnum ~w1
IfInt %faces = 1 LocTurn ~w1 180
ObjectAdd ~w1
# forward warp
Cos %c %alpha
Sin %d %alpha
Mul %ns2 %ds %c
Mul %we2 %ds %d
StringFromReal $ns2 %ns2 2
IfString "-" IsIn $ns2
Else Concat $ns2 "+" $ns2
StringFromReal $we2 %we2 2
IfString "-" IsIn $we2
Else Concat $we2 "+" $we2
Concat $ac2 "create visible off;bump warp " $ns2 " " $we2
GetPosition ~w2
LocTurn ~w2 180
GetModel ~w2 $panel
GetAction ~w2 $ac2
GetCitnum ~w2
IfInt %faces = 1 LocTurn ~w2 180
ObjectAdd ~w2
EndSub
Event Chat
GetChatPerson &p
IfPerson &p IsNotBoss EndEvent
GetChatLine $a
IfString "model" IsIn $a Gosub SetModel
Else IfString "faces you" IsIn $a Gosub SetFacesYou
Else IfString "faces away" IsIn $a Gosub SetFacesAway
Else IfString "distance" IsIn $a Gosub SetDistance
Else IfString "repeat" IsIn $a Gosub SetRepeat
Else IfString "state" IsIn $a Gosub SayState
Else IfString "action" IsIn $a Gosub SayAction
Else IfString "help" IsIn $a Gosub SayHelp
Else IfString "menu" IsIn $a Gosub SayHelp
Else IfString "build" IsIn $a Gosub SetBuild
EndEvent
Sub SetModel
Split $b $c $a "model"
Trim $c $c
$panel = $c
Concat $a "Model is " $panel
Say $a
Gosub SayState
EndSub
Sub SetDistance
Split $b $c $a "distance"
Trim $c $c
%dist = $c
Max %dist %dist 0.5
StringFromReal $c %dist
Concat $a "Distance is " $c
Say $a
Gosub SayState
EndSub
Sub SetRepeat
Split $b $c $a "repeat"
Trim $c $c
%repeat = $c
Max %repeat %repeat 1
$c = %repeat
Concat $a "Repeat is " $c
Say $a
Gosub SayState
EndSub
Sub SetBuild
StringFromReal $d %dist
IfInt %repeat = 1 Concat $a "Building a two-way warp (range " $d " metres), model " $panel
Else Concat $a "Building " %repeat " two-way warps at " $d " metres interval, model " $panel
Say $a
ResetTo Build
EndSub
Sub SetFacesYou
%faces = 1
Say Model faces you
Gosub SayState
EndSub
Sub SetFacesAway
%faces = 0
Say Model faces away
Gosub SayState
EndSub
Sub SayState
StringFromReal $d %dist
IfInt %faces = 0 $z = " faces away from you"
Else $z = " faces you"
IfInt %repeat = 1 Concat $a "Ready to build a two-way warp (range " $d " metres), model " $panel $z
Else Concat $a "Ready to build " %repeat " two-way warps at " $d " metres interval, model " $panel $z
Say $a
EndSub
Sub SayHelp
Concat $a "To change parameters, say 'Model
|