| 08-27-2006, 09:41 PM | #1 | |
DELTE THIS THREAD IM DUMB AND I FOUND THE ERROR! -thanks moderator Okay, I'm working on an alphabetical check sequence to check for valid/invalid characters, and it combines using a loop inside of a loop on a condition function. However I'm given the following errors on these colors in this code. Error 1: Expected a name Error 2: Expected 'endloop' These are the errors: Quote:
JASS:function Trig_spfchck_Func002Func002C takes nothing returns boolean set udg_spfloop1=1 set udg_spfloop2=1 loop exitwhen udg_spfloop1 > 17 set udg_spfloop2=1 set udg_badcharacter=false loop exitwhen udg_spfloop2 > 38 if ( not ( SubStringBJ(GetPlayerName(ConvertedPlayer(GetForLoopIndexA())), udg_spfloop1, udg_spfloop1) == udg_ValidCharacters[udg_spoofloop2] ) ) then call DoNothing( ) else set udg_badcharacter = true endif set udg_spfloop2 = udg_spfloop2 + 1 endloop if (udg_badcharacter == false) then return false endif set udg_spfloop1 = udg_spfloop1 + 1 endloop return true endfunction function Trig_spfchck_Actions takes nothing returns nothing call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_213" ) set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 12 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd call SetPlayerName( ConvertedPlayer(GetForLoopIndexA()), GetPlayerName(GetEnumPlayer()) ) if ( Trig_spfchck_Func002Func002C() ) then call DoNothing( ) else set udg_flagspfs[GetForLoopIndexA()] = true endif set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop endfunction //=========================================================================== function InitTrig_spfchck takes nothing returns nothing set gg_trg_spfchck = CreateTrigger( ) call DisableTrigger( gg_trg_spfchck ) call TriggerAddAction( gg_trg_spfchck, function Trig_spfchck_Actions ) endfunction If you need to know anything more about it go ahead and ask me. Perhaps maybe I should make a seperate function like "GetForLoopIndexA()" for returning my loop variants? Or do I need to make a seperate exitloop sequence variable rather than just straight 38 or 17? Thanks in advance for any help. -oxide2007 |
| 08-27-2006, 09:47 PM | #2 |
Whoa crap. What are those [size] and [color] tags doing in there? Put all of this into jass tags, por favor. Also, why is GetForLoopIndexA() even in there? I don't see you modifying or setting it anywhere in that code. |
| 08-27-2006, 09:51 PM | #3 |
Learn to write JASS, don't use GUI=>JASS conversions as actual code. Gets you into really bad habits, and produces ugly and inefficient code with BJs and random functions. |
| 08-27-2006, 09:55 PM | #4 |
No the for loop comes in from the actions here why dont i just throw the whole script in... And sorry I dont write in straight Jass because I don't fully understand all of it... and what order im supposed to put stuff in. EDIT: PLEASE DELETE THIS ENTIRE THREAD. I'm embarassed to annouce I was just a dumbass and instead of saying "udg_spfloop2" i said "udg_spoofloop2" I changed it and it works... sorry im even checked the variables and then i checked it like five more times and found it. |
| 08-27-2006, 10:21 PM | #5 |
try this, I'm sure it's fucked up somehow but it was such a mess to begin with it's hard to get it correct right away.. JASS:function SpoofCheck takes string pname returns boolean local integer i = 0 local integer l local boolean b loop exitwhen i > 16 set l = 0 set b = false loop exitwhen l > 37 or b if SubString(pname, i-1, i) == udg_ValidCharacters[l] then set b = true endif set l = l+1 endloop if not b then return false endif set i = i+1 endloop return true endfunction //=========================================================================== function InitTrig_spfchck takes nothing returns nothing local integer i = 0 call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "TRIGSTR_213") loop exitwhen i > 11 set udg_flagspfs[i] = SpoofCheck(GetPlayerName(Player(i))) set i = i+1 endloop endfunction |
| 08-27-2006, 10:27 PM | #6 |
What Aquilla made is so much prettier. :O That's how it should look. |
