• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] pretty much typing text to name

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
Im thinking there already something like this done.
What would be the easiest way to take what you type and make it a title of a leader-board.
pretty much just say i type Team 1 i want it to replace Red Team

well more so a command to trigger it (forgot lol) like -Team Name "text here for name"
  • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label |cffFF0000Red Team|... and value CTF_Team_Points[1]
would do it myself but too tired and lazy at the moment lol so rep for who does ^^
 
JASS:
scope TitleSetterTest initializer Init
globals
    private leaderboard someBoard = null
    private constant string COMMAND = "-settitle "
    private constant integer COMMAND_LENGTH = StringLength(COMMAND)
endglobals

private function SetTitle takes nothing returns nothing
    local string s = GetEventPlayerChatString()
    if SubString(s, 0, COMMAND_LENGTH) == COMMAND then
        call LeaderboardSetLabel(someBoard, SubString(s, COMMAND_LENGTH, StringLength(s)))
    endif
endfunction

private function SetUpBoard takes nothing returns nothing
    set someBoard = CreateLeaderboard()
    call LeaderboardSetLabel(someBoard, "Initial Label")
    call ForceSetLeaderboardBJ(someBoard, bj_FORCE_ALL_PLAYERS)
    call LeaderboardDisplay(someBoard, true)
endfunction

private function Init takes nothing returns nothing
    local timer x = CreateTimer()
    local trigger t = CreateTrigger()
    local integer i = 0
    call TimerStart(x, 0, false, function SetUpBoard)
    loop
        call TriggerRegisterPlayerChatEvent(t, Player(i), COMMAND, false)
        set i = i + 1
        exitwhen i >= 12
    endloop
    call TriggerAddAction(t, function SetTitle)
    call DestroyTimer(x)
    set x = null
    set t = null
endfunction
endscope
Like this, easy.
 
isnt what you want just this?
  • team name
    • Events
      • Player - Player 1 (Red) types a chat message containing -team name as A substring
      • -------- etc for other players --------
    • Conditions
    • Actions
      • Leaderboard - Change the title of (Last created leaderboard) to (Substring((Entered chat string), 11, (Length of (Entered chat string))))
 
Status
Not open for further replies.
Back
Top