Hello folks.
I have struggled with a script that I am working on for a few hours now. I've spent most of the time wading back and forth in the vast sea of help files and the forums. Without finding (or understanding, [I admit that I'm not the sharpest tool in the box]) the information I need, I finally cracked and decided to ask for help in the form of this new post.
The MUD I am making this script for is called "Legends of the Jedi" and is a heavily modified SWR. In the MUD it is possible to purchase a freighter ship to transport varying resources from planet to planet and thus earn credits.
In the MUD there is a command "showplanet <planet> resources" that shows the current rates of the 0 to 10 different resources available on the planet like this:
You use the datapad to lookup the information.
--Planet Data: -------------------------------
Planet: Coruscant
Starsystem: Coruscant
Governed By: The New Republic
Planet Funds: 25000
Electronics ( Price per unit: 11.38)
Food ( Price per unit: 7.91 )
Goods ( Price per unit: 1.94 )
Lumber ( Price per unit: 9.22 )
Precious metals ( Price per unit: 1.79 )
Spice ( Price per unit: 1.09 )
Water ( Price per unit: 10.51)
Weapons ( Price per unit: 11.54)
I have created an alias "reso *" to do the command above.
The purpose of this script is to calculate the difference between the resource prices of two different planets and print it on the output. The script is pasted below and is executed by the alias "cargoroute * to *".
SetVariable ("cargo_from", "%1");
SetVariable ("cargo_to", "%2");
AddTriggerEx ("Cargo_A", "* ( Price per unit: *)", "SetVariable ("Resource_%1_from", "%2")", "1", "-1", "0", "", "", "12", "100");
Execute ("reso "%1"");
DeleteTrigger ("Cargo_A");
AddTriggerEx ("Cargo_B", "* ( Price per unit: *)", "SetVariable ("Resource_%1_to", "%2")", "1", "-1", "0", "", "", "12", "100");
Execute ("reso "%2"");
DeleteTrigger ("Cargo_B");
Resource_Electronics_to = tonumber (GetVariable ("Resource_Electronics_To"));
Resource_Electronics_from = tonumber (GetVariable ("Resource_Electronics_from"));
Electronics_difference = Resource_Electronics_to - Resource_Electronics_from;
Note "Electronics Rate: $Electronics_difference$";
The problem that I am currently facing is:
The AddVariable function that is "inside" the AddTrigger (on line 4) picks up "coruscant" from the alias that executes the script, instead of the %1 passing in to the trigger it creates.
The error message that MushClient gives me is:
Compile error
World: Legends of the Jedi
Immediate execution
[string "Alias: "]:4: ')' expected near 'Resource_coruscant_from'
I'll be very thankful if you can give me any kind of advice on this problem, also I would be very happy to have a somekind of a mentor on my buddy list on either AIM or MSN that I could have quick tips from since I feel very hesitant on posting on the forums (I don't want to be a nuisance).
-Henry |