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

JAS Syntax Errors

Status
Not open for further replies.
Level 4
Joined
Dec 26, 2009
Messages
64
So, I`m currently working on a project called romaen. Romaen searches the string for numbers, removes them, and only displays the letters. In the future, when I`m completely done, you will be able to pick to remove all numbers, certain letters, etx c. But, right now, I`m having trouble with the basic code, before I`ve added anything advanced. Currently, nothing is displayed with the BJDebugMsg.

JASS:
             /////////////////////////////////////////////////////////////
             //                                                         //
             //                         ROMAEN                          //
             //                                                         //
             /////////////////////////////////////////////////////////////

 function romaen takes string s returns string
   local integer d = 0
   local integer q = 0
   local integer w = 1
   local string n = ""
 loop
     if SubString(s,q,w) == "0" then
       set d = 1
       set s = n
     else
       set n = n + SubString(s,q,w)
     endif
 exitwhen d == 1
     set q = q + 1
     set w = w + 1
 endloop
//     set s = n
     return s
 endfunction

function Trig_test_Actions takes nothing returns nothing
  local string s = "lol"
  call BJDebugMsg(romaen(s))
endfunction

function InitTrig_test takes nothing returns nothing
    set gg_trg_test = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_test, Player(0) )
    call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction

I fixed the above code > > But any constructive criticism and comments are wanted.
 
Level 4
Joined
Dec 26, 2009
Messages
64
Heh.

This is the base function for the three commands I`m creating.

1) Removes all numbers from a string
2) Removes all letters from a string
3) Removes a selected character from a string

This would be helpful for debugging, codes, string manipulation, and just sifting through things.

0t1h4i9s 3i4s5 4a6 s3e0c1r2t5 m87e0s1s1a5g0e
 
Status
Not open for further replies.
Top