| 08-03-2003, 03:23 PM | #1 |
Hello, i have made a new function : len, its count how many caracter have in a string. I do a loop and a if with a substring. This is the GUI : Code:
For each (Integer A) from 1 to 1000, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring(string_to_len, (Integer A), ((Integer A) + 1))) Equal to <Empty String>
Then - Actions
Skip remaining actions
Else - Actions
Set len = (len + 1)And in Jass : Code:
function Trig_Len_Script_Copy_2_Func001Func001C takes nothing returns boolean
if ( not ( SubStringBJ(udg_string_to_len, GetForLoopIndexA(), ( GetForLoopIndexA() + 1 )) == "" ) ) then
return false
endif
return true
endfunction
function Trig_Len_Script_Copy_2_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 1000
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( Trig_Len_Script_Copy_2_Func001Func001C() ) then
return
else
set udg_len = ( udg_len + 1 )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_Len_Script_Copy_2 takes nothing returns nothing
set gg_trg_Len_Script_Copy_2 = CreateTrigger( )
call TriggerAddAction( gg_trg_Len_Script_Copy_2, function Trig_Len_Script_Copy_2_Actions )
endfunction
My function use : Code:
LenBJ=0,1,string,string
_LenBJ_Defaults=_,_
_LenBJ_Category=TC_NOTHINGAnd Code:
LenBJ="Len"
LenBJ="Len(",~String,")"
LenBJHint=But the function won't work :( If someone can help me ! This is my last test of the function : Code:
function LenBJ takes string txt returns integer
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 1000
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( not ( SubStringBJ(txt, GetForLoopIndexA(), ( GetForLoopIndexA() + 1 )) == "" ) ) then
return bj_len
endloop
else
set bj_len = ( bj_len + 1 )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunctionSorry for my bad english (i'm french) and ++ |
| 08-03-2003, 06:50 PM | #2 |
Don't edit the TriggerData.txt and TriggerStrings.txt files. Instead, in the trigger editor click at the map name on the left and copy your custom function into the big text box below. If you have TFT, in the comment box, there should be some info about that. |
| 08-03-2003, 09:46 PM | #3 |
ok, if ur messing with trigstrings.txt and trigdata.txt, i'm assuming that means this function is located in blizz.j right? if not, then first of all, u'll need to declare that function in blizzard.j. if u've already done that then i don't know. there's something wierd with creating new gui. i've never actually successfully done it. i can call my functions from blizz.j in a map, but i've never done a gui ver. for it. |
| 08-04-2003, 10:47 AM | #4 |
k, i will wait a patch. I think the blizz.j is "protected" because i can't modify a function ... |
| 08-04-2003, 08:33 PM | #5 |
no. u can modify it. open blizzard.j with notepad. in there, create your "len" function. then from there u can call len via jass script in ur maps. try it, and ask me if u have ne probs. i've gotten a few new functions into blizz.j |
