| 01-21-2006, 04:28 PM | #1 |
I'm trying to create a trigger that can turn any players name into rainbow colours and to do this i want to set it as a string and a player does trigger this with a chat message. The action is simply: Trigger: Actions![]() Set Adminsupername = (|cffFF0000 + ((Substring((Name of (Triggering player)), 1, 1)) + (|r + (|cffFF8000 + ((Substring((Name of (Triggering player)), 2, 2)) + (|r + (|cffFFFF00 + ((Substring((Name of (Triggering player)), 3, 3)) + (|r + (|cff00FF40 + ((Substring((Name of (Triggering player)), 4, 4)) + (|r + ...This carries on until 15,15 because that is max name length and i've already tried doing up to 15 for players with 15 long names up to 14 for players with 14 long names but it still crashes the editor. Thanks for any help i guess there's just seomthing i don't understand about substrings. |
| 01-21-2006, 04:46 PM | #2 |
Perhaps giving the substring function a starting integer thats over the string length crashes wc3. Try filling the playername with spaces untill the length is 15. |
| 01-21-2006, 05:35 PM | #3 |
Thanks for the quick reply. It still crashed and i don't think the problem is that as it only goes to 15 if the string length of a player's name is 15 and so on. The crash message is: |
| 01-22-2006, 08:32 AM | #4 |
Anyone? I really need to do this to finish my map. (Bump) |
| 01-22-2006, 09:35 AM | #5 |
It is possible that substrings start counting at 0. So for 23 character string, like the one below, the id of last letter is 22. i d _ o f _ l a s t _ l e t t e r _ i s _ 2 2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 In other words, there is no character #15 in 15 character string. They go from 0 to 14 EDIT: tried matching numbers to letters with spaces up above. Didn't work, but you should still get the idea :) |
| 01-22-2006, 09:43 AM | #6 |
Are you 100% sure that this is the trigger which crashes the game? |
| 01-22-2006, 10:35 AM | #7 |
qwetyui: I hadn't thought of that but it makes sense i will try it (now i think about it the 256 colour things go from 0 to 255 so no reason why substrings don't) EDIT: The example for the trigger suggests this isn't the case but i will try Jacek: Yes, i'm certain it is that trigger especially since i can delibertely cause that error by typeing in an invalid substring for another trigger, plus if i create a map with only that trigger it crahses when i run it. UPDATE: Tried what you suggested but still no luck (Thats using the spaces instead of player name + starting from 0,0) any more ideas? Does anyone know if there's a max string length? |
| 01-22-2006, 10:47 AM | #8 |
Maximum String Length is about 800 chars. It cause nightmares with maps so don't worry this isn't your problem. That only applies to one piece of text so using sub strings doens't have this issue. |
| 01-22-2006, 10:50 AM | #9 |
I've just realised i've messed up the trigger i'm using to test ( the one with spaces) so i'm redoing it. The main trigger is fine (as in looks right but crashes) One of your solutions may work. I tried all your suggestions again with the fixed trigger but it still crashes. By the way Jazradel, it could because the colour codes are each quite long and they are stored together in a string variable but it doesn't top 800 (10*15 + 1*15 + 2*15) Here's the trigger in an empty map i'd appreciate it if someone would have a look |
| 01-22-2006, 09:29 PM | #10 |
Hmm, try turning your trigger to jass, u will notice it splits lines, which is most probably why it crashes, I cant find any other reason at the moment. Try doing it in parts. |
| 01-23-2006, 02:52 PM | #11 |
By doing it in parts do you mean set the first letter to stringvariable[1] the second letter to stringvariable[2] and so on then add them together afterwards and save them as another string? UPDATE: I've tried that and it works so far without the colour codes i'm now adding the colour codes UPDATE2: Works with the colour codes!!! yay thanks guys!!! Expect to see this map (not the empty one) in the samples later 9or not as it's rejected on the grounds of just being a map, fair enough, but apparently i didn't make it as well but nevermind) |
