HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

-ally (color) alliances

02-19-2006, 09:33 AM#1
Sardrixx
im not good at jass, and i doubt it can be done in GUI, how would i make it (in less then 10 triggers) so when a player (1-4 only) says -ally (color) (5-12 only)they ally
i can incorperate dialogue boxes myself (unless its jass, that may cause a problem)

but this has really stumped me, i dont want to waste like 90 triggers doin this... i would be most greatful for any help
02-19-2006, 11:40 AM#2
iNfraNe
how about getting the number from the entered chatstring and converting that number to a player?
02-19-2006, 11:52 AM#3
Captain Griffen
Just test the substing(event response - entered chat string, 7, 16) against a list of colours (using either a variable array and a loop, or just if/then/else).
02-19-2006, 01:06 PM#4
Chuckle_Brother
Colours are an ugly way to do it, I suggest using player indices, that was you can use the entry directly within your ally change function
02-19-2006, 01:48 PM#5
Captain Griffen
But colours are a lot easier for players to type, rather than player numbers (which can be gotten wrong...which is especially bad with kick functions).
02-20-2006, 04:59 PM#6
Sardrixx
Quote:
Just test the substing(event response - entered chat string, 7, 16) against a list of colours (using either a variable array and a loop, or just if/then/else).

mmmm how would i set up the loop, and why is it 7, 16 and not 5, 12 for players 5-12 (yellow-brown), did you have some special reasoning??

now that i think about it, im COMPLETELY confused...
could you show me how it would look in the editor, and explain it?
02-20-2006, 05:16 PM#7
Captain Griffen
Quote:
Originally Posted by Sardrixx
mmmm how would i set up the loop, and why is it 7, 16 and not 5, 12 for players 5-12 (yellow-brown), did you have some special reasoning??

Well, that's just to define which part of the string it wants, 7-16 would get the colours.

In map initialisation, set a variable array, colours, with a size of 12, to the right string for each variable in the array:

set colours[1] = red
...
set colours[12] = brown

Then make this trigger:

Event:

Player 1 enters a chat string containing -ally as a substring.
Player 2 enters a chat string containing -ally as a substring.
Player 3 enters a chat string containing -ally as a substring.
Player 4 enters a chat string containing -ally as a substring.

Condition:

substring(entered chat string, 1, 5) is equal to "-ally"

Event:

for each loop integer A 5 to 12:
loop
if colours[integer A] is equal to substring(entered chat string, 7, 16)
then: (INSERT ALLY COMMAND)
else: game - display to triggering player "You cannot ally with that player."
02-20-2006, 05:30 PM#8
Sardrixx
i feel dumb now, but i understand... its exactly what i thaught at first, but then i said wait WHAA?? if this works your a god
and im absolutely positively sure it will
one problem, what comparison did you use to get colours[interger A] because im having trouble finding it... unless its the player color comparison, but on that i cant get substring (entered chatstring, 7, 16)