_________________ If you have any questions drop in by chat sometime, chances are there'll be someone who can help you that's afking there, so the next best thing is to click the link on UndeadxAssassin's Sig and ask your question there.
Joined: February 24th, 2009, 1:31 pm Posts: 3815 Location: JEW LAND
Durge wrote:
Wonderful, it worked perfectly haxorico, your 100% pure genius. Thank you everyone who posted here for their feedback and help.
EDIT:Hmm, moving the part that goes into function main into a different call (cause there were some problems with it being in function main) made my -repick command to stop working. I figured it was just string overwrite, so I changed the strings for my godly command, but that didnt seem to help at all, any ideas?
You are really missing the point in the code I wrote. You don't need to place 2 triggers or 2 function parts etc.. Here is an example that might explain it a little better with comments inside.
Spoiler:
Code:
globals trigger trgChat=CreateTrigger() //The trigger that will be activated upon every chat command endglobals
function ChatCommands takes nothing returns nothing local string str=StringCase(GetEventPlayerChatString(),false)//A string variable holding the text writted, I turned it into a lower-case string to ease the "detection" of the written string. local group grp=CreateGroup() //A group variable to hold all our picked units. local unit unt //A unit variable to hold our picked unit. if str=="-repick"then //An example for a command that doesn't require picked units. //enter repick code here elseif str=="-test"then //Another example for a command that doesn't require picked units, this can go on for ever, you can add as many "elseif" as you want to make every string command you want. call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Test worked") //An action that happens after you used the string command endif //Stops to check for a command that doesn't demmand a picked unit. call GroupEnumUnitsSelected(grp,GetTriggerPlayer(),null) //setting our group variable to hold our picked units loop //looping our group for all the units we picked set unt=FirstOfGroup(grp) //setting the unit variable to the first/next unit we picked exitwhen unt==null //exitwhen the next unit is null, meaning there is no other unit if str=="-godly all"then //An example for a command that requires picked units //enter godly code here elseif str=="-kill"then //Another example for a command that requires picked units call KillUnit(unt) //An action that happens after using the string command. endif //Stops to check for any string commands call RemoveLocation(GetUnitLoc(unt)) //Removing Leaks call GroupRemoveUnit(grp,unt) //Removing Leaks endloop //Ending the loop and going for the next unit. call DestroyGroup(grp) //Removing Leaks set str="" //Removing Leaks set grp=null //Removing Leaks set unt=null //Removing Leaks endfunction
function main takes nothing returns nothing call TriggerRegisterPlayerChatEvent(trgChat,Player(0),"-",false) //Each time Player(0) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(1),"-",false) //Each time Player(1) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(2),"-",false) //Each time Player(2) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(3),"-",false) //Each time Player(3) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(4),"-",false) //Each time Player(4) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(5),"-",false) //Each time Player(5) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(6),"-",false) //Each time Player(6) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(7),"-",false) //Each time Player(7) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(8),"-",false) //Each time Player(8) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(9),"-",false) //Each time Player(9) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(10),"-",false) //Each time Player(10) writes a string containing "-", it will be triggered call TriggerRegisterPlayerChatEvent(trgChat,Player(11),"-",false) //Each time Player(11) writes a string containing "-", it will be triggered call TriggerAddAction(trgChat,function ChatCommands) //The function that will be caleld once the trigger is triggerd. endfunction
I hope this helps you to understand it better.
_________________
Spoiler:
(02:24:09)
Code:
ChatBot: FatherSpace logs into the Chat. (02:24:28) Lanaya: Gtfo ken. (02:24:33) ChatBot: FatherSpace logs out of the Chat. (02:24:40) Lanaya: Thought so. bitch. (02:24:44) ChatBot: FatherSpace logs into the Chat. (02:24:48) FatherSpace: Can I come back yet? (02:24:51) Lanaya: What'd i say earlier. (02:24:51) Lanaya: No. (02:24:58) FatherSpace: Let's try this... (02:25:01) ChatBot: Lanaya has been logged out (Kicked).
Code:
(14:33:51) 2Pac: Do you know what'S so funny? (14:34:01) Lanaya: No, please show me. (14:34:07) 2Pac: This. (14:34:09) ChatBot: Lanaya has been logged out (Kicked). (14:34:10) 2Pac:
Code:
(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^ (14:36:02) Lanaya: lolz. (14:36:16) 2Pac: I AIN'T DEAD FFS. (14:36:26) 2Pac: I'm a living legend, y'now. (14:37:17) haxorico: why is 2Pac a legend? (14:37:28) Lanaya: He's the worse rapper evar.
Code:
(15:42:51) Lanaya: can i suck , . . .
Code:
(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1. (13:55:21) ChatBot: haxorico rolls 1d2 and gets 2. (13:55:27) haxorico: owned?
Code:
GeorgeMots: xplain what happens in SP. Why cant you save? dast.-:i need play with 2 players
Code:
(21:53:08) (673237): plzplzplz, im sorry about before. (21:53:26) FatherSpace: I'm sorry you were born. (21:53:31) ChatBot: (673237) has been logged out (Kicked).
Code:
(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
Users browsing this forum: No registered users and 25 guests
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 post attachments in this forum