I am making a trigger on one of my maps so that a player must enter a chat string that equals an integer variable that is set in another trigger. However, on the "events" (player enters chat message), i put in "convert string to integer" but the integer that i have prepared does not show on the usable variable list. Am I doing something wrong? Can you not use integers in input chat strings? Do you need a different kind of variable for this? Or am i doing something completely obviously silly? Help much appreciated. Teifi
this might just have been a typo but you said you were looking under "convert string to integer" and didn't see your integer variable...the explanation is that an integer won't show up when you're trying to convert a *string* to an *integer*...
now like i said, you may have just misspoken, but that's the only problem i can see from the information you gave. if you are trying to convert the entered chat string to an integer and store the value in your variable then i do not see why it isn't working.
Oh yeah sorry mate, that was a typo indeed. Since its confusing to say it, then I shall say it in the context of the map:
A code is required to open a certain door, which can be input by a chat string. Since I do not want the code to be the same every game, I have set it to randomise it between 1 and 9999 at the start of the map. I then want an event that is basically:
[When a player enters a chat string that is EQUAL to that integer], then do action etc.
However, when programming the event for chat string, I cant seem to find anywhere to be able to input that feature.
(EDIT) Another way of saying it is that the variable doesnt show when im trying to check that a chat string is the same as an integer. (/EDIT)
Very useful mate, thank you, but theres just one problem.
In the event, player[1] types in "chat". What do i put for the "chat" part? How do i make an event that is triggered when the player types in anything? Its that event part im stuck on.
GUI is dumb, and wont let you use variables in events
make an event on the trigger that is Elapsed Game Time is 0.01 seconds
then, make THESE actions
Player Group - Pick Every Player in *the players that can type the message* and do multiple actions Loop-Actions Custom Script: call TriggerRegisterPlayerChatEvent( GetTriggeringTrigger(), GetEnumPlayer(), GetRandomInt( 1, 9999 ), true )
ignore that old post, made a few mistakes cuz i had to go to class in about a min
jsut
for the action, if you just want a random integer between 1 and 9999, just make the event be
A Player Types a Chat Message Containing( Convert Integer to String( Math-random integer number between 1 and 9999 ) ) ) as an Exact Match
there was a func i forgot to add to the custom script line, and anyways the function would massively leak, cuz i forgot a few other lines =/
the reason that GUI does not allow you to assign variables to events is this - events are set in stone when they are initialized. They cannot be changed, so if Your Variable was equal to "bob" when the event line was called, it would always equal "bob", even if you changed it to "cheese"
coding is just another word for triggering. it comes from the fact that early programming was a lot like making codes or something. it was extremely complex anyways.