1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger Viewer

Simple Prefix System 0.0.3.w3x
Variables
Simple Prefix System
Variables
---- Set this to define the prefix that is used
Library
SPSLibrary
SPSSetPrefix with GUI
SPSSetPrefix with Arg
Nothing special
HELLO 1
HELLO 2
HELLO 3
HELLO 4
Implementation
SPSMapBegin
SPSUnitEnterMap
SPSSelect Unit
Escribe debajo el código del guión personalizado especial para el mapa. El texto se incluirá en el guión del mapa después de declarar las variables y antes de los códigos de los detonadores.

		
Name Type Is Array Initial Value
SPSPrefix string No
testUnit unit No
Internally PREFIX_SEPARATOR gets set to whatever this is at SPSInit. Default string is "!"

Functions are declared here:
globals

    string PREFIX_SEPARATOR = "!"
    group PREFIX_OFF_GROUP = CreateGroup()

endglobals

library SPS

    function SPSSetPrefixArg takes string prefix returns nothing
        set PREFIX_SEPARATOR = prefix
    endfunction

    function SPSSetPrefixGUI takes nothing returns nothing
        set PREFIX_SEPARATOR = udg_SPSPrefix
    endfunction

    function SPSGetRealName takes string unitName, integer separatorPosition returns string

        local integer stringLength = StringLength(unitName)
        local string prefix
        local string remainString
        local string newUnitName

        set prefix = SubString(unitName, 0, separatorPosition)
        set remainString = SubString(unitName, separatorPosition+2, stringLength)

        call BJDebugMsg("|cffffff00Prefix|r: " + prefix)
        call BJDebugMsg("|cffffff00Separator|r: " + PREFIX_SEPARATOR)
        call BJDebugMsg("|cffffff00Real Name|r: " + remainString)

        return remainString
    endfunction

    function SPSGetSeparatorPosition takes string unitName returns integer

        local integer i = 0
        local integer stringLength = StringLength(unitName)
        local boolean hasFindPrefix = false
        local string tempString
        local integer separatorPosition

        loop
            set tempString = SubString(unitName, i, i + 1)
            if (tempString == PREFIX_SEPARATOR) then
                if (hasFindPrefix == false) then
                    set separatorPosition = i
                    set hasFindPrefix = true
                endif
            endif
            set i = i + 1
            exitwhen i == stringLength
        endloop
        return separatorPosition
    endfunction

    function SPSSetRealName takes unit u returns nothing
        local string unitName
        local integer separatorPosition
        local string unitRealName

        if (IsUnitInGroup(u, PREFIX_OFF_GROUP) == true) then
            return
        else

            set unitName = GetUnitName(u)
            set separatorPosition = SPSGetSeparatorPosition(unitName)
            set unitRealName = SPSGetRealName(unitName, separatorPosition)
            call BlzSetUnitName(u, unitRealName)
            call GroupAddUnit(PREFIX_OFF_GROUP, u)
            set u = null
        endif
    endfunction

endlibrary
For Internal Use Only:
SPSetPrefix gets called to set the internal prefix string to the GUI-level SPS_Prefix global. You could set PREFIX_SEPARATOR or call this function yourself whenever you'd like if you prefer.
SPSSetPrefix with GUI
  Events
    Time - Elapsed game time is 0.00 seconds
  Conditions
  Actions
    Set VariableSet SPSPrefix = !
    Game - Display to (All players) the text: |cffc0c0c0Default Prefix|r: |cff008000!|r
    Custom script: call SPSSetPrefixGUI()
For Internal Use Only:
SPSetPrefixArg gets called to set the internal prefix string using a prefix parameter. You could set PREFIX_SEPARATOR or call this function yourself whenever you'd like if you prefer.
SPSSetPrefix with Arg
  Events
    Time - Elapsed game time is 0.00 seconds
  Conditions
  Actions
    Game - Display to (All players) the text: |cffc0c0c0Default Prefix|r: |cff008000!|r
    Custom script: call SPSSetPrefix("!")
HELLO 1
  Events
    Map initialization
  Conditions
  Actions
    Custom script: call ClearTextMessages()
    Trigger - Turn off (This trigger)
    Game - Display to (All players) the text: |cffffff00Simple Prefix System V.0.0.3|rOrganize your object editor adding PREFIX to the unit name and later removing that PREFIX when using unit in-gameCredits to:|cffffff00Allknowledge aka iam20842|r [port gui idea and behavior to jass]|cffffff00Templarfreak|r [original idea]Press ESCAPE please :D





HELLO 2
  Events
    Player - Player 1 (Red) skips a cinematic sequence
  Conditions
  Actions
    Custom script: call ClearTextMessages()
    Trigger - Turn off (This trigger)
    Game - Display to (All players) the text: |cffffff00How it work?|rAdd prefix to your units in object editor using the PREFIX_SEPARATOR defined in SPSConfig, like this |cff8080ffUNDEAD|r|cff80ff80!|r |cffc0c0c0Lord of Death|r. they system will remove all string until get the separator(|cff80ff80!|r)Voila! in object editor you got ordered preffix name and in-game the real unit namePress enter chat message |cffffff00next|r :D
    Trigger - Turn on HELLO_3 <gen>
HELLO 3
  Events
    Player - Player 1 (Red) types a chat message containing next (stringnoformat) as An exact match
  Conditions
  Actions
    Custom script: call ClearTextMessages()
    Trigger - Turn off (This trigger)
    Trigger - Turn on HELLO_4 <gen>
    Game - Display to (All players) the text: |cffffff00Set prefix with|r:|cff808080call SPSSetPrefixArg(prefix)|r | need parameter prefixor|cff808080call SPSSetPrefixGUI()|r | will assign the value of |cff8080ffudg_SPSPrefix|rPlease enter in chat this: |cffffff00more? |r XD
HELLO 4
  Events
    Player - Player 1 (Red) types a chat message containing more? (stringnoformat) as An exact match
  Conditions
  Actions
    Custom script: call ClearTextMessages()
    Trigger - Turn on (This trigger)
    Game - Display to (All players) the text: |cffffff00Testing|r: Select unit event|cff80ff80SPS working|r: select your unit|cffff8080SPS not working|r: select enemy unit
SPSMapBegin
  Events
    Time - Elapsed game time is 1.00 seconds
  Conditions
  Actions
    Trigger - Turn off (This trigger)
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      Loop - Actions
        Set VariableSet testUnit = (Picked unit)
        Custom script: call SPSSetRealName(udg_testUnit)
        Custom script: set udg_testUnit = null
SPSUnitEnterMap
  Events
    Unit - A unit enters (Playable map area)
  Conditions
  Actions
    Set VariableSet testUnit = (Entering unit)
    Custom script: call SPSSetRealName(udg_testUnit)
    Custom script: set udg_testUnit = null
SPSSelect Unit
  Events
    Player - Player 1 (Red) Selects a unit
  Conditions
    (Owner of (Triggering unit)) Equal to Player 1 (Red)
  Actions
    Set VariableSet testUnit = (Triggering unit)
    Custom script: call SPSSetRealName(udg_testUnit)
    Custom script: set udg_testUnit = null