• 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.

[Trigger] String trigger help please.

Status
Not open for further replies.
Level 1
Joined
Dec 30, 2008
Messages
5
I cant find out whats wrong with this trigger. It uses the first two letters of the players name to tell set numbers to a player. However, it only seems to work for the last letter (z).

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Intigers[(Integer(a))] = 47hg6
      • Set Intigers[(Integer(b))] = ns72hj
      • Set Intigers[(Integer(c))] = 982h7
      • Set Intigers[(Integer(d))] = je7h2
      • Set Intigers[(Integer(e))] = 832js7
      • Set Intigers[(Integer(f))] = 92hs7
      • Set Intigers[(Integer(g))] = 82ha7
      • Set Intigers[(Integer(h))] = na78h
      • Set Intigers[(Integer(i))] = 82a7a
      • Set Intigers[(Integer(j))] = js8h2a
      • Set Intigers[(Integer(k))] = 87edhs
      • Set Intigers[(Integer(l))] = 83h7s
      • Set Intigers[(Integer(m))] = q9aj3
      • Set Intigers[(Integer(n))] = ks832
      • Set Intigers[(Integer(o))] = kd8hs
      • Set Intigers[(Integer(p))] = 9ns72
      • Set Intigers[(Integer(q))] = 9en73
      • Set Intigers[(Integer(r))] = o9sh2
      • Set Intigers[(Integer(s))] = 0amns
      • Set Intigers[(Integer(t))] = 9w3mh
      • Set Intigers[(Integer(u))] = 9dsn1
      • Set Intigers[(Integer(v))] = jsx82h
      • Set Intigers[(Integer(w))] = 9w2n7
      • Set Intigers[(Integer(x))] = js8hj3
      • Set Intigers[(Integer(y))] = u8shy
      • Set Intigers[(Integer(z))] = 8h63w
  • code
    • Events
      • Player - Player 1 (Red) types a chat message containing -code as An exact match
    • Conditions
      • (Triggering player) Equal to Player 1 (Red)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering player) Equal to Player 1 (Red)
        • Then - Actions
          • Set PlayerName[1] = (Substring((Name of (Triggering player)), 1, 1))
          • Set PlayerName[2] = (Substring((Name of (Triggering player)), 2, 2))
          • Set Change[1] = Intigers[(Integer(PlayerName[1]))]
          • Set Change[2] = Intigers[(Integer(PlayerName[2]))]
          • Game - Display to (Player group((Triggering player))) the text: (Change[1] + Change[2])
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: ERROR!!!!
Any help would be appreciated.
 
Level 1
Joined
Dec 30, 2008
Messages
5
True, but that shouldent have any effect as to why the trigger isiant working. This trigger is intended to work when a unit enters a region, for testing purposes i just changed the event from entering region, to a chat message.

Edit : Dunno if its going to help any or not, but all three variables above are string arrays.
 
Integer(a) just comes out as 0, and so do all the other letters, which is why z, the last one, is the only one that works. There is a solution for this in JASS, by using the following function:

JASS:
function StringHash takes string s returns integer
    return s
    return 0
endfunction

If you have patch v1.24 you can use the native (in-built function). I don't know if this is available in GUI in v1.24.
 
Level 1
Joined
Dec 30, 2008
Messages
5
Element of Water said:
Integer(a) just comes out as 0, and so do all the other letters, which is why z, the last one, is the only one that works. There is a solution for this in JASS, by using the following function:

JASS:
function StringHash takes string s returns integer
    return s
    return 0
endfunction

Sorry, im good with jass at the least, mind explaining what i should do please? ;x Btw, thanks for all the help in such a short time.
 
Status
Not open for further replies.
Top