|
billydekidd Newbie
Joined: 31 Mar 2003 Posts: 5
|
Posted: Mon Jul 21, 2003 8:31 am
trigger to buy things |
I'm new to Zmud, but I've read some of the posts and have yet to come across what I'm looking for this time. I want to set up a system where I check with the game to see how much credits cost and buy them if they are at a certain price
I have an alarm set up, so every few minutes, the command goes out to check the prices. But when the prices come back I want a trigger to buy the credits at a certain price. the text that comes back looks like this:
144 credits at 4200 gold per credit.
109 credits at 4300 gold per credit.
etc...
Now if I want to buy 5 credits at no more than 4200 gold, my syntax would be:
credits buy 5 at 4200
Can anyone help me setting this up?
Thanks |
|
|
|
RobMacAF Apprentice
Joined: 09 Jun 2002 Posts: 186 Location: USA
|
Posted: Mon Jul 21, 2003 4:20 pm |
If you wanted a trigger to capture the gold it would be easy...Something like this would suffice.
TRIGGER: (%d) credits at (%d) gold per credit.
If we used this: 144 credits at 4200 gold per credit.
Then %1 would be 144 and 4200 would be %2
You can then assign these to variables in the script part of the trigger
#VAR Credits %1
#VAR GoldPerCredits %2
Now to match the GoldPerCredits to see if it is what you want we could do something like this...
#IF (@GoldPerCredits=4200) {credits buy 5 at @GoldPerCredits}
This is the most basic way of doing it. The way I would do it is this though....
*** Make a class (folder) called Credit
*** Make an alias called CreditsOn in the root class (root folder)
SCRIPT:
#T+ Credit
#VAR BuyCredits %1
#VAR BuyPerCredits %2
(what this does is when you type CreditsOn, it will start up your credits script. This way you can turn it on and off. It also makes 2 variables. The first one is the amount you want to buy. And the second variable is the amount you want to buy at...
So if you wanted something like this: credits buy 5 at 4200.
You just type CreditsOn 5 4200
Now that we have the alias we make the trigger. In the credit class you made make a trigger.
TRIGGER: (%d) credits at (%d) gold per credit.
SCRIPT:
#VAR Credits %1
#VAR GoldPerCredits %2
#IF (@GoldPerCredits = @BuyPerCredits) {credits buy @BuyCredits at @BuyPerCredits}
Now while this class is on. Which you turned on using CreditsOn alias it will fire everytime the credits are checked. It assigns the first number as Credits and the Second as GoldPerCredits...
So if it got this: 144 credits at 4200 gold per credit.
144 would be stored as Credits, 4200 as GoldPerCredits
Now it starts an If statement that checks to see if the GoldPerCredits is what you set it as the second number in your alias. If it is then it buys the amount you set in your alias, first number after the alias.
So if you typed CreditsOn 5 4200
Then whenever it checked the credits and it matched * credits at 4200 gold per credit then it would send this to the mud: credits buy 5 at 4200
You should also make an off alias if you ever want to turn it off. To do that just make an alias called CreditsOff and make the script for it #T- Credit
There is also many different ways to do this but I think this is fairly simple. It lets you turn it on and off and allows you to change the values you want it to buy at. You can also make a button instead of an alias, use a toggle button, and just put the script for CreditsOn on one toggle, and the script for CreditsOff on the other toggle.
I tried not to make this very confusing but I wanted to explain everything I did so that you could understand why I did what I did. If you ever want help you can email me RobAMacAF@yahoo.com or AIM-RobMac00, MSN-RobMacAF@msn.com, YahooIM-RobAMacAF |
|
|
|
billydekidd Newbie
Joined: 31 Mar 2003 Posts: 5
|
Posted: Mon Jul 21, 2003 7:48 pm |
Thanks RobMacAF for the help, but I have another little problem.
this is what I did:
-made class folder Credit
-made alias called CreditsOn and CreditsOff in Credit class
-put trigger you suggested in Credit class
BUT I got a syntax error when I put in the {{credits buy @BuyCredits at @BuyPerCredits}
AND since there are many prices for credits (there are perhaps 10 different lines) the variables, I think, took the last line of the text which was "34 credits at 5000 gold per credit" making the trigger not fire.
Last question - I have an #alarm that I would like to put in the CreditsOn alias and CreditsOff alias. Right now its: #alarm -0:30 {credits for sale}.
How would I put it so that it stops when I use the Creditsoff alias?
thanks for all the help! |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Jul 21, 2003 10:42 pm |
For your last question, you need name your alarm and then use that name in the #T- command:
#alarm "tCreditsCheck" -0:30 {credits for sale}
#alias Creditsoff {#T- tCreditsCheck}
As for your syntax error, make sure all your curly braces are matched up. If they are, go back and make sure they are at the right places. |
|
|
|
|
|
|
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
|
|