Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Dec 09, 2003 1:24 am   

Various SWR scripts - Star Wars Reality MUDS
 
Various Scripts captured from the forums.

Automatic Armor Layer Building with a database Lightbulb's work

Database with fields:
Wearloc
Name
Color
Material
MatContainer
FinishContainer

Script: Originally posted by LightBulb

#AL Makearmor {#IF (%numparam() <> 1) {#SAY Please supply the name of the database only} {#DBLOAD %1;#DBFIRST;doarmor}}
#AL doarmor {#IF %null( %rec) {#SAY Finished} {#VAR curloc {%db( %rec, wearloc)};#VAR curcolor {%db( %rec, color)};#VAR curname {%db( %rec, name)};#VAR curmaterial {%db( %rec, Material)};#VAR curMcontainer {%db( %rec, MatContainer)};#VAR curFcontainer {%db( %rec, FinishContainer)};get '@curmaterial' '@curMcontainer';~makearmor @curloc %quote( @curcolor)@curname}}
#TR {You finish your work and hold up your newly created armor.} {repairarmor '@curname'}
#TR {You finish your work and hold up the fully repaired armor} {get '@curmaterial' '@curMcontainer';enhancearmor '@curname'}
#TR {It doesn't look very damaged at all} {get '@curmaterial' '@curMcontainer';enhancearmor '@curname'}
#TR {You finish your work and hold up the enhanced armor} {get '@curmaterial' '@curMcontainer';enhancearmor '@curname'}
#TR {I doubt if you could make that armor any better!} {put '@curmaterial' '2.curMcontainer';put '@curname' @curFcontainer;#DBNEXT;doarmor}
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Dec 09, 2003 1:29 am   
 
Automatic Armor Layer Building with a list Lightbulb's work

Originally posted by LightBulb


It's possible to build-in a delay, but it would be preferable to trigger off the completion message. This can be done by using two variables. The first will contain a list of the items you want to make (use your existing alias names), and the second will be a number which keeps track of where you are in the list. A third variable can be used (if desired) for a status line display (so you'll know when it's safe to type again). Since you already have individual aliases with the necessary commands for each item, you can continue using them but have a new alias or trigger do the typing instead of you. It's best to use a subclass for the triggers, so that you can control when they work. That way, you can easily make individual armor pieces when you want, without setting off the triggers.

The easiest way to make a list (as long as it doesn't have any duplicate items) is with the #ADDITEM (#ADDI) command. This works just like the #VARIABLE (#VAR) command, except it adds a new item to the end of the list instead of replacing the entire variable. You use #VAR to clear the list. #ADD is the simplest way of changing the tracking variable.

First, make your list:
#VAR ArmorList %null
#ADDI ArmorList hands1
#ADDI ArmorList arms1
#ADDI ArmorList body1
#ADDI ArmorList hands2
#ADDI ArmorList arms2
etc.

Then make the triggers and alias.
#CLASS MakeArmor disable
#TR {You finish your work and hold up your newly created garment} {#IF (@ArmorPointer < %numitems(@ArmorList)) {#ADD ArmorPointer 1;#EXEC %item(@ArmorList, @ArmorPointer)} {#T- MakeArmor;#VAR ArmorPointer 1;#VAR ArmorMaking finished}}
#TR {You are interrupted and fail to finish your work} {#VAR ArmorMaking INTERRUPTED;#MESSAGE {Armor making interrupted! Type RESUME when ready to continue}}
#AL RESUME {#VAR ArmorMaking working;#EXEC %item(@ArmorList, @ArmorPointer)}
#CLASS 0
#AL MakeSet {#VAR ArmorPointer 1;#VAR ArmorMaking working;#T+ MakeArmor;#EXEC %item(@ArmorList, @ArmorPointer)}
#ST {Armor making: @ArmorMaking}
#VAR ArmorMaking finished finished

Untested. The command you would type to start making a set is "makeset".

//

Originally posted by LightBulb

To stop the script: Do something (anything) else.
To restart the script at the same place it stopped: Type RESUME (or resume)
To restart the script at the beginning: Type MakeSet

It would probably be a good idea to move the alias, RESUME, out of the subclass. If you did that, you could then add the #T- command to the interrupt trigger. You would also need to add the #T+ command to the RESUME alias.
#TR {You are interrupted and fail to finish your work} {#VAR ArmorMaking INTERRUPTED;#MESSAGE {Armor making interrupted! Type RESUME when ready to continue};#T- MakeArmor} {MakeArmor}
#AL RESUME {#T+ MakeArmor;#VAR ArmorMaking working;#EXEC %item(@ArmorList, @ArmorPointer)}
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Dec 09, 2003 1:32 am   
 
Cargo Trade Price checker script by Lightbulb
(appears to be for LOTJ)

Originally posted by LightBulb

This should work. I've tested it, repeatedly, as best I can. I provided another set of display aliases at the end, they should provide a more useful display. After doing sales, just type bestroutes. If you decide to continue using it, it would probably be helpful to shorten the name.

#TRIGGER {Planet: (*)} {planetlow = {%1}} "getlowprices"
#TRIGGER {(%w)*~( Price per unit: (%d).(%d) ~)} {#MATH templow ((%2 * 100) + %3);#IF (%ismember( %1, @lowlist)) {#IF (@templow < %db( @%1low, price)) {#VARIABLE %1low "";#ADDKEY %1low {price=@templow|planet=@planetlow}}} {#ADDITEM lowlist "%1";#VARIABLE %1low "";#ADDKEY %1low {price=@templow|planet=@planetlow}}} "getlowprices"
#ALIAS lowprices {#FORALL @lowlist {showlow %{i}}}
#ALIAS showlow {#SHOW lowest price for %1: %expanddb( @{%1low}, " on the ", ": ")}
#TRIGGER {--Planet Data-} {#T+ getlowprices}
#TRIGGER {Planet: (*)} {planet = {%1}} "getprices"
#TRIGGER {(%w)*~( Price per unit: (%d).(%d) ~)} {#MATH temp ((%2 * 100) + %3);#IF (%ismember( %1, @profitlist)) {#IF (@temp > %db( @%1, price)) {#VARIABLE %1 "";#ADDKEY %1 {price=@temp|planet=@planet}}} {#ADDITEM profitlist "%1";#VARIABLE %1 "";#ADDKEY %1 {price=@temp|planet=@planet}}} "getprices"
#ALIAS bestprices {#FORALL @profitlist {showgood %i}}
#ALIAS showgood {#SHOW Best price for %1: %expanddb( @{%1}, " on the ", ": ")}
#TRIGGER {--Planet Data} {#T+ getprices}
#AL sales {#FORALL @lowlist {#VAR temp1 %{i}low;#UNVAR @temp1};#UNVAR lowlist;#FORALL @profitlist {#VAR temp2 %{i};#UNVAR @temp2};#UNVAR profitlist;Showplanet Byss resources;Showplanet Coruscant resources;Showplanet Yavin resources;Showplanet Corellia resources;Showplanet Ryloth resources;Showplanet Gamorr resources;Showplanet Tatooine resources;Showplanet Kashyyyk resources;Showplanet Wroona resources;Showplanet Roche resources;Showplanet 'Nal hutta' resources;showplanet 'Nim Drovis' resources;Showplanet 'Ord Mantell' resources}
#AL bestroutes {#FORALL @lowlist {showbest %{i}}}
#AL showbest {#SHOW lowest price for %1: %expanddb( @{%1low}, " on the ", ": ");#SHOW Best price for %1: %expanddb( @{%1}, " on the ", ": ");#CR}


A database still might be better (you could use the %max and %min functions) if you or Emit want to continue working on one.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Dec 09, 2003 1:53 am   
 
Space Travelling

Lightbulb's work

Originally posted by LightBulb

#TR {Hyperspace course set. Ready for the jump to lightspeed.} {hyperspace}//no change
#TR {Your mobile suit lurches slightly as it comes out of hyperspace.} {radar}//no change
#TR {Proximity alert: Colony M9 -50000 -35600 -15600} {land m9;#VAR destination {l3 80000 60000 -19600}}
#TR {You feel a slight thud as the ship sets down on the ground.} (launch}
#TR {The ship leaves the platform far behind as it flies into space.} {calc @destination}
#TR {Proximity alert: Colony L3 80000 60000 -20000} {land l3;#VAR destination {l1 -50000 -35600 -15200}}
;Comments in blue

//

Depending on the SWR implementation what you want:

#TR {^Colony (%a): (%n) (%n) (%n)} {course %2 %3 %4}
#TR {The platform is still to far away to land.} {#ALA +5 {land}}
Reply with quote
VaughnLee
Newbie


Joined: 10 Jan 2008
Posts: 3

PostPosted: Sun Jan 13, 2008 2:27 pm   
 
also I'm having trouble with the training trigger for this

"You fail to work the controls properly"
this is the fail report for commands
shields
speed
radar
course
launch
and hyperspace'

i'd like to cycle a trigger to input shields( repeat on fail. after success, next command) trying to rotate them all in the simulator
then idealy to disable a class when it adepts


lots.wolfpaw.net 3000 legacy of the sith
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Jan 16, 2008 5:03 am   
 
Use something like this:

#ONINPUT {^&%*{LastCommand}$} {#NOOP}
#TRIGGER {You fail to work the controls properly} {@LastCommand}
Reply with quote
VaughnLee
Newbie


Joined: 10 Jan 2008
Posts: 3

PostPosted: Sat Jan 26, 2008 5:58 pm   
 
with a little tweaking that worked sort of


how bout if i use the speed menu?

[rightclick] research %selword
[pattern] : you feel a bit more skilled.
[triggered effect] research %selword
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net