| 03-18-2004, 10:47 PM | #1 |
yeah i am making a gold trading system in my map and i was wondering if i could make this coding any better, particularaly if i could make it so that you weren't forced to give a 3 digit number this is what i got going right now Code:
Events
Player - Player 1 (Red) types a chat message containing -give as A substring
Player - Player 2 (Blue) types a chat message containing -give as A substring
Player - Player 3 (Teal) types a chat message containing -give as A substring
Player - Player 4 (Purple) types a chat message containing -give as A substring
Conditions
((Triggering player) Current gold) Greater than or equal to (Integer((Substring((Entered chat string), 6, 7))))
Actions
Set goldXfer[1] = (100 x (Integer((Substring((Entered chat string), 8, 8)))))
Set goldXfer[2] = (10 x (Integer((Substring((Entered chat string), 9, 9)))))
Set goldXfer[3] = (Integer((Substring((Entered chat string), 10, 10))))
Set goldXfer[4] = (goldXfer[1] + (goldXfer[2] + goldXfer[3]))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
goldXfer[4] Less than or equal to ((Triggering player) Current gold)
Then - Actions
Player - Add goldXfer[4] to (Random player from (All players matching ((Player number of (Matching player)) Equal to (Integer((Substring((Entered chat string), 6, 6))))))) Current gold
Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - goldXfer[4])
Game - Display to (All players) the text: ((PlayerNwC[(Player number of (Triggering player))] + gave ) + (PlayerNwC[(Integer((Substring((Entered chat string), 6, 6))))] + (( |c00ff8000gold|r + (String(goldXfer[4]))) + gold|r. |c0000ff00There is now a 2 second cooldown in effect for gold trading.|r)
Else - Actions
Trigger - Turn off (This trigger)
Wait 2.00 seconds
Trigger - Turn on (This trigger)variabels are as follows: PlayerNwC[x]: This is just the player's name with a color, the array number correspondes with the player number. ie.) Player1 account name is Ugly then "Ugly", in red text would appear, Player2's name is Pretty, then "Pretty" in blue text would appear goldxfer[x]: 1 - 3 = the first diget, and so on | 4 = what the final number comes too. |
| 03-18-2004, 11:06 PM | #2 |
I give you a hint: F11 |
| 03-18-2004, 11:39 PM | #3 | |
Quote:
BTW: Here is a trigger that i was hoping that would work so that you can trade gold w/o HAVING to type in 3 interger, i just know that there is a way for it to be. and i think that the reason this doens't work is because since it can't recognize an integer it stops the whole trigger. Code:
Events
Player - Player 1 (Red) types a chat message containing -give as A substring
Player - Player 2 (Blue) types a chat message containing -give as A substring
Player - Player 3 (Teal) types a chat message containing -give as A substring
Player - Player 4 (Purple) types a chat message containing -give as A substring
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((Entered chat string), 8, 8)))) Greater than or equal to 0
(Integer((Substring((Entered chat string), 9, 9)))) Greater than or equal to 0
(Integer((Substring((Entered chat string), 10, 10)))) Greater than or equal to 0
Then - Actions
Set goldXfer[1] = (100 x (Integer((Substring((Entered chat string), 8, 8)))))
Set goldXfer[2] = (10 x (Integer((Substring((Entered chat string), 9, 9)))))
Set goldXfer[3] = (Integer((Substring((Entered chat string), 10, 10))))
Set goldXfer[4] = (goldXfer[1] + (goldXfer[2] + goldXfer[3]))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
goldXfer[4] Less than or equal to ((Triggering player) Current gold)
Then - Actions
Player - Add goldXfer[4] to (Random player from (All players matching ((Player number of (Matching player)) Equal to (Integer((Substring((Entered chat string), 6, 6))))))) Current gold
Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - goldXfer[4])
Game - Display to (All players) the text: ((PlayerNwC[(Player number of (Triggering player))] + gave ) + (PlayerNwC[(Integer((Substring((Entered chat string), 6, 6))))] + (( |c00ff8000gold|r + (String(goldXfer[4]))) + gold|r. |c0000ff00There is now a 2 second cooldown in effect for gold trading.|r)
Trigger - Turn off (This trigger)
Wait 2.00 seconds
Trigger - Turn on (This trigger)
Else - Actions
Skip remaining actions
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((Entered chat string), 8, 8)))) Greater than or equal to 0
(Integer((Substring((Entered chat string), 9, 9)))) Greater than or equal to 0
Then - Actions
Set goldXfer[1] = (10 x (Integer((Substring((Entered chat string), 8, 8)))))
Set goldXfer[2] = (1 x (Integer((Substring((Entered chat string), 9, 9)))))
Set goldXfer[4] = (goldXfer[1] + goldXfer[2])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
goldXfer[4] Less than or equal to ((Triggering player) Current gold)
Then - Actions
Player - Add goldXfer[4] to (Random player from (All players matching ((Player number of (Matching player)) Equal to (Integer((Substring((Entered chat string), 6, 6))))))) Current gold
Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - goldXfer[4])
Game - Display to (All players) the text: ((PlayerNwC[(Player number of (Triggering player))] + gave ) + (PlayerNwC[(Integer((Substring((Entered chat string), 6, 6))))] + (( |c00ff8000gold|r + (String(goldXfer[4]))) + gold|r. |c0000ff00There is now a 2 second cooldown in effect for gold trading.|r)
Trigger - Turn off (This trigger)
Wait 2.00 seconds
Trigger - Turn on (This trigger)
Else - Actions
Skip remaining actions
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((Entered chat string), 8, 8)))) Greater than or equal to 0
Then - Actions
Set goldXfer[1] = (1 x (Integer((Substring((Entered chat string), 8, 8)))))
Set goldXfer[4] = (goldXfer[1] + goldXfer[2])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
goldXfer[4] Less than or equal to ((Triggering player) Current gold)
Then - Actions
Player - Add goldXfer[4] to (Random player from (All players matching ((Player number of (Matching player)) Equal to (Integer((Substring((Entered chat string), 6, 6))))))) Current gold
Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - goldXfer[4])
Game - Display to (All players) the text: ((PlayerNwC[(Player number of (Triggering player))] + gave ) + (PlayerNwC[(Integer((Substring((Entered chat string), 6, 6))))] + (( |c00ff8000gold|r + (String(goldXfer[4]))) + gold|r. |c0000ff00There is now a 2 second cooldown in effect for gold trading.|r)
Trigger - Turn off (This trigger)
Wait 2.00 seconds
Trigger - Turn on (This trigger)
Else - Actions
Else - Actions
Do nothing |
| 03-18-2004, 11:44 PM | #4 |
You can change the increment per click. |
| 03-19-2004, 12:02 AM | #5 |
Maybe just do this: instead of useing like 3 substrings, use 1!!! u can do it so instead of a huge trigger u can make it so it is 9,13 or so!!! U have 4 varables just to do 1 action when that is ont needed, you can do this (my 1 player version) Event: Player 1 types -give as a substring Conditions: players current gold is greaterthan of equal to Integer(string to integer(substring(entered Chat string)7,11))) Substring(entered chat string)7,11 greaterthan 0 Action: Add (-•(String to integer(Substring(entered chat string)7,11)) to player 1's current gold Add (String to Integer(Substring(entered chat string)7,11) to (Convert Player Index to Player(string to integer(substring(entered chat string)13,13)'s current gold Just to clairify -• means Negitive Times (x) |
| 03-19-2004, 12:10 AM | #6 |
you mean from 100 to 200?argg thats 2 spam posts in 1 thread |
| 03-19-2004, 12:27 AM | #7 | |
Quote:
That was hard... |
| 03-19-2004, 12:35 AM | #8 | |
Quote:
|
| 03-19-2004, 12:48 AM | #9 |
Whut? Did u read my trigger? ive tested it and it worked. I think that is whut u were talking about =/ If not please Clairfy. [edit] uhh ok, i think useing triggers is better if u set the number too high, you cant give it exactly but u can do it faster, triggers can be exact and quick, -give 5000 3 will give 500 gold to teal! woo |
| 03-19-2004, 01:01 AM | #10 |
ok screw all that, everything is done and set and the trigger works. It requires only 1 variables thats an array. It only supports 1-9 player though and only 3 digit max trading, but your not forced to give a certain amount of digits. So all of these work. -give2 157 -give2 15 -give2 1 You don't have to but -give2 015 and -give2 001 will also work If you want the trigger for your map then tell me and i will post it. |
| 03-19-2004, 01:53 AM | #11 |
cause jass is to damn complicated for me |
| 03-19-2004, 02:11 AM | #12 |
thx, but my thing works now. lol sry |
| 03-19-2004, 11:49 PM | #13 |
hi im not that skilled with triggers to the point that i had a hard time geting grouped units to different regions so i was wondering if u could post a map with just that trigger on it and i would be eternally grateful. |
| 03-20-2004, 02:59 AM | #14 | |
Quote:
I take great umbridge at that. Just because you don't understand the help you're being given doesn't mean you have the right to call our posts spam and unhelpful; either ask for clarification or use another suggestion. |
| 03-20-2004, 03:10 PM | #15 |
what ever one you feel works best or you could clarify how to in put the jass script or a combination of the two. btw thanks for taken the time to help. |
