skip navigation

Welcome, Guest [log in · register]
Cwn Annwn
Search
Page 1 of 1 1
Bubblegum Well, ive been trying to make a pirating income script, im getting stuck on a few parts, mainly adding the income to the variable, here’s what i have so far:
[CODE]
#CLASS {Piratingincome} {Disabled}
#VAR Income {0}
#TRIGGER {hands you ?{%d}? gold} {#ADD income %1}
#TRIGGER {It will cost %d gp to repair the damage to this ship.} {Help}
#TRIGGER {It will cost %d gp to recharge the ship’s shielding.} {help}
#TRIGGER {It will cost %d gp to refuel this ship.} {help}
#TRIGGER {takes %d gp from you} {help again}
#ALIAS Displayincome {#Echo You have earned {#VAR income} so far.}
^not working :( ^
#ALIAS incomeon {#CLASS Piratingincome 1}
#ALIAS incomeoff {#CLASS Piratingincome 0}
#CLASS 0
[CODE]

For some reason the first trigger isn’t working, and i cant find the command to take away x from the variable, and how to display the variable during an echo, any help would be much appreciated.
Katran
Avatar
Why did you have question marks around that trigger?

I don’t actually know what the output looks like since I don’t have a ship. But you need to use parentheses (not the curly brackets!) to enclose the text that you want saved to the variable %1. So I guess it would look like this:

#TRIGGER {hands you (%d) gold} {#ADD income %1}

To subtract, use the #ADD command with a negative value.

Also,

#ALIAS displayincome {#ECHO You have earned @income so far.}


I’m not sure what you wanted to do with the other triggers. Details? :S

Last edited on August 22, 2008 12:52am.
Bubblegum thanks for the tips, i added the question marks because it originally had [ ] around the money, it was conflicting with zmud commands i think, so i just used 2 wildcards, i’ll try it out and get back to you.

*Edit*
Ok, the problems keep on comming, heres what it looks like so far:

#VAR Income {0}
#TRIGGER {hands you ?(%d)? gold} {#ADD income %1}
#TRIGGER {It will cost (%d) gp to repair the damage to this ship.} {#ADD income -%1}
#TRIGGER {It will cost (%d) gp to recharge the ship’s shielding.} {#ADD income -%1}
#TRIGGER {It will cost (%d) gp to refuel this ship.} {#ADD income -%1}
#TRIGGER {takes (%d) gp from you} {#ADD income -%1}
#ALIAS Displayincome {#Echo You have earned @income so far.}


the alias is working, but still it refuses to add the income to the variable (and take away from it) its starting to drive me up the wall.


Last edited on August 22, 2008 09:51am.
*Edit*
ok, i have switched the #ADD for the #MATH, but their is still a problem, zmud doesn’t seem to know how to handle decimal places within numbers, is their any way to get around this?

#VAR Income {0}
#TRIGGER {hands you ?(%d)? gold} {#MATH income (@income+%1)}
#TRIGGER {It will cost (%d) gp to repair the damage to this ship.} {#MATH income (@income-%1)}
#TRIGGER {It will cost (%d) gp to recharge the ship’s shielding.} {#MATH income (@income-%1)}
#TRIGGER {It will cost (%d) gp to refuel this ship.} {#MATH income (@income-%1)}
#TRIGGER {takes (%d) gp from you} {#MATH income (@income-%1)}
#ALIAS Displayincome {#Echo You have earned @income so far.}


Last edited on August 22, 2008 10:21am.

*edit again*
Been busy, decided to work around the decimals, but im bad at math (or zmud is)

#VAR Income {0}
#TRIGGER {hands you ?(%d),(%d)? gold} {#MATH income (1000*%1+@income);#MATH income (%1+@income)}
#TRIGGER {It will cost (%d),(%d) gp to repair the damage to this ship.} {#MATH income (-1000*%1+@income);#MATH income (%1-@income)}
#TRIGGER {It will cost (%d),(%d) gp to recharge the ship’s shielding.} {#MATH income (-1000*%1+@income);#MATH income (%1-@income)}
#TRIGGER {It will cost (%d),(%d) gp to refuel this ship.} {#MATH income (-1000*%1+@income);#MATH income (%1-@income)}
#TRIGGER {takes (%d),(%d) gp from you} {#MATH income (-1000*%1+@income);#MATH income (%1-@income)}
#ALIAS Displayincome {#Echo You have earned @income so far.}

"#TRIGGER {hands you ?(%d),(%d)? gold} {#MATH income (1000*%1+@income);#MATH income (%1+@income)}" works as intended, not sure why (-1000*%1+@income) isnt working, its comming out as


Its finnished and working now. so here we go

#VAR Income {0}
#TRIGGER {hands you ?(%d),(%d)? gold} {#MATH income (%1%2+@income)}
#TRIGGER {It will cost (%d),(%d) gp to repair the damage to this ship.} {#MATH income (0-%1%2+@income)}
#TRIGGER {It will cost (%d),(%d) gp to recharge the ship’s shielding.} {#MATH income (0-%1%2+@income)}
#TRIGGER {It will cost (%d),(%d) gp to refuel this ship.} {#MATH income (0-%1%2+@income)}
#TRIGGER {takes (%d),(%d) gp from you} {#MATH income (0-%1%2+@income)}
#ALIAS Displayincome {#Echo You have earned @income so far.}


Just a few notes, type "displayincome" to check how much you’ve made.
It wont count anything smaller than 1000 gold, or anything larger than 999,999 gold when purchasing or selling, so try to keep within those values if you can, i may also need someone to provide the strings for salvaging your ship etc, but its pretty much finnished now.

Last edited on August 22, 2008 11:25am.
Karo If I recall correctly, to use [ and ] in scripts, put a ~ before it.
For example:
#TRIGGER {hands you ~[(%d),(%d)~] gold} {#MATH income (%1%2+@income)}


Edit:
Unless you were trying to use [] to catch the numbers and the brackets arnt in the patter you are trying to match.

If you’d like, there is another way to take the comma out of the money string in order to make the math part a little simpler.

Last edited on August 24, 2008 07:28am.
Bubblegum nah, its all finished now, just need a bit of formatting on the numbers and its perfect.

#ALIAS Displayincome {#Echo You have earned @income so far.}
#ALIAS sayincome {say I have earned @income gold from pirating so far.}
#VAR Income {0}
#TRIGGER {hands you ?(%d),(%d)? gold} {#MATH income (%1%2+@income)}
#TRIGGER {It will cost (%d),(%d) gp to repair the damage to this ship.} {#MATH income (0-%1%2+@income)}
#TRIGGER {It will cost (%d),(%d) gp to recharge the ship’s shielding.} {#MATH income (0-%1%2+@income)}
#TRIGGER {It will cost (%d),(%d) gp to refuel this ship.} {#MATH income (0-%1%2+@income)}
#TRIGGER {takes (%d),(%d) gp from you} {#MATH income (0-%1%2+@income)}
#STAT {Made so far @income}
Page 1 of 1 1