• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Camera Change

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2013
Messages
1,105
Hello, how do I change it so that a player can choose how far out they'd want to zoom?

  • [TRIGGER]Camera Change
    • Events
      • Player - Player 1 (Red) types a chat message containing -cam as An exact match
      • Player - Player 2 (Blue) types a chat message containing -cam as An exact match
      • Player - Player 3 (Teal) types a chat message containing -cam as An exact match
      • Player - Player 4 (Purple) types a chat message containing -cam as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -cam as An exact match
      • Player - Player 6 (Orange) types a chat message containing -cam as An exact match
      • Player - Player 7 (Green) types a chat message containing -cam as An exact match
      • Player - Player 8 (Pink) types a chat message containing -cam as An exact match
      • Player - Player 9 (Gray) types a chat message containing -cam as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -cam as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -cam as An exact match
      • Player - Player 12 (Brown) types a chat message containing -cam as An exact match
    • Conditions
    • Actions
      • Player Group - Add (Triggering player) to CamPlayerGroup
      • Player Group - Pick every player in CamPlayerGroup and do (Actions)
        • Loop - Actions
          • Camera - Set (Picked player)'s camera Distance to target to 2500.00 over 0.00 seconds
          • Player Group - Remove (Picked player) from CamPlayerGroup
[/TRIGGER]


I'm trying to make it so any number the user enter has their screen zoom accordingly. And not just a flat 2500

Any help would be fantastic!
 
Instead of as "an exact match", put "as a substring".

Then basically set an integer variable equal to "Convert String to integer - Substring (entered chat message) from 6 to (length of entered chat message)". Or something like that. I don't have the editor on hand.

That way, you can parse the integer value they place after the -cam message. Make sure you check if the integer is 0 or something, because that is what it may return if they enter an invalid code, like "-cam abc"
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
As what Purge said, use of Substring is really needed. Here is a tutorial of deathismyfriend about Substring and this might help you make your own too:

Things a GUier should know

Just go to Chapter 9 and Use of Substrings.
Mostly what he does is set into variables the Triggering Player (the one who typed I think), TempString (The Entered CHat String and others for the Sub String whick I know composes here are the integers used.
 
Status
Not open for further replies.
Top