Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2010-05-06 (original capture). Home · Forum · All archived topics · Downloads

Author Topic: checkscript  (Read 27 times)

Offline Grim Reaper

  • Level 7 Expert
  • *****
  • Posts: 167
  • WCS Coding helper :)
checkscript
« on: April 28, 2010, 01:46:13 AM »
I checked my race here at http://mattie.info/cs/checkscript.asp and i wanna know if this is good or bad
Code: [Select]
<% OpenBracketCount = 0 CloseBracketCount = 0 LineBracket = 0 QuotationMarks = 0 LineCount = 0 ErrorCount = 0 BlockErrorCount = 0 FirstPass = 0 OpenParenCount = 0 CloseParenCount = 0 LineParen = 0 sOutput = "" origscript = "" comment = 0 Function EventCheck If InStr(strLine,"event") = 1 Then arrEventCheck = Split(strLine," ") If arrEventCheck(0) = "event" Then FirstPass = FirstPass + 1 If FirstPass > 1 Then CloseCurrentBlock End If If UBound(arrEventCheck) = 1 Then CurrentBlock = arrEventCheck(1) sOutput = sOutput + "<----------| event " & CurrentBlock sOutput = sOutput + "
" End If End If End If End Function Sub BlockCheck If InStr(strLine, "block") = 1 Then arrBlockCheck = Split(strLine, " ") If arrBlockCheck(0) = "block" Then FirstPass = FirstPass + 1 If FirstPass > 1 Then CloseCurrentBlock End If If UBound(arrBlockCheck) = 1 Then CurrentBlock = arrBlockCheck(1) sOutput = sOutput + "<----------| block " & CurrentBlock sOutput = sOutput + "
" End If End If End If End Sub Sub CloseCurrentBlock If OpenBracketCount <> CloseBracketCount Then ErrorCount = ErrorCount + 1 BlockErrorCount = BlockErrorCount + 1 sOutput = sOutput + "" + CStr(BlockErrorCount) & "." & " " & "There are missing or extra brackets in this block:
" & _ " { = " & CStr(OpenBracketCount) & "
" & _ " } = " & CStr(CloseBracketCount) + "
" End If 'sOutput = sOutput + "
" OpenBracketCount = 0 CloseBracketCount = 0 QuotationMarks = 0 BlockErrorCount = 0 End Sub Function GetLine(strString) InStr() End Function Function In1(strIn, strFind) If (InStr(strIn, strFind) > 0) Then In1 = True End If End Function Function DoWarning(strString) ' & "ma_cexec_all has been deprecated by latest Mani versions. Use es_cexec_all or ma_cexec #all instead. sOutput = sOutput + "Warning: Line #" & CStr(LineCount) & ":" & vbTab & CStr(BlockErrorCount) & "." & vbTab + strString + "
" End Function Function DoError(strString) sOutput = sOutput + "Error: Line #" & CStr(LineCount) & ":" & vbTab & CStr(BlockErrorCount) & "." & vbTab + strString + "
" End Function Function StripComments(script) newscript = "" xlines = Split(script, vbCrLf) For i = LBound(xlines) to UBound(xlines) strLine = Trim(xlines(i)) comment = InStr(strLine, "//") If comment > 0 Then stripped = Trim(Mid(strLine, 1, comment-1)) if (Len(stripped) > 0) then newscript = newscript + Mid(strLine, 1, comment-1) + vbCrLf End If Else newscript = newscript + strLine + vbCrLf End If Next StripComments = newscript End Function script = Request.Form("script") if Len(script) > 0 then origscript = script 'Strip comments script = StripComments(script) sOutput = sOutput + "

    Parsing... (results below)

    " lines = Split(script, vbCrLf) For i = LBound(lines) to UBound(lines) strLine = lines(i) strLine = LTrim(strLine) LineCount = LineCount + 1 EventCheck BlockCheck If (OpenBracketCount = CloseBracketCount) AND Len(Trim(strLine))>0 And (InStr(strLine, "event")=0 And InStr(strLine, "block")=0 And InStr(strLine, "{")=0 And InStr(strLine, "}")=0) Then DoWarning("Unreachable code not in a block: " + Left(Trim(strLine),15) + " ...") 'Else 'Response.Write ("

    "+strLine+"

    o" + CStr(OpenBracketCount) + " c" + CStr(CloseBracketCount)) End If '85 If InStr(strLine, "{") > 0 Then OpenBracketCount = OpenBracketCount + 1 arrOpenBracket = Split(strLine, "{") LineBracket = LineBracket + UBound(arrOpenBracket) End If If InStr(strLine, "}") > 0 Then CloseBracketCount = CloseBracketCount + 1 arrCloseBracket = Split(strLine, "}") LineBracket = LineBracket + UBound(arrCloseBracket) End If If LineBracket > 1 Then ErrorCount = ErrorCount + 1 BlockErrorCount = BlockErrorCount + 1 sOutput = sOutput + "Line #" & CStr(LineCount) & ":" & vbTab & CStr(BlockErrorCount) & "." & vbTab & "More than 1 { or } on a single line.
    " End If LineBracket = 0 If InStr(strLine, "(") > 0 Then OpenParenCount = OpenParenCount + 1 arrOpenParen = Split(strLine, "(") LineParen = LineParen + UBound(arrOpenParen) End If If InStr(strLine, ")") > 0 Then CloseParenCount = CloseParenCount + 1 arrCloseParen = Split(strLine, ")") LineParen = LineParen - UBound(arrCloseParen) End If If LineParen <> 0 Then ErrorCount = ErrorCount + 1 BlockErrorCount = BlockErrorCount + 1 If LineParen > 0 Then sOutput = sOutput + "Line #" & CStr(LineCount) & ":" & vbTab & CStr(BlockErrorCount) & "." & vbTab & "Missing " + CStr(LineParen) + " close parentheses.
    " Else sOutput = sOutput + "Line #" & CStr(LineCount) & ":" & vbTab & CStr(BlockErrorCount) & "." & vbTab & "Too many (" + CStr(Abs(LineParen)) + ") close parentheses.
    " End If End If LineParen = 0 'Warnings. 'ma_cexec_all If InStr(strLine, "ma_cexec_all") > 0 Then DoWarning("ma_cexec_all has been deprecated by latest Mani versions. Use es_cexec_all or ma_cexec #all instead.") End If If InStr(strLine, "eventscripts_noisy") > 0 Then DoWarning("eventscripts_noisy should rarely be referenced directly. See the corelib documentation for enabling/disabling it.") End If If InStr(strLine, chr(34)) Then arrQuotations = Split(strLine, chr(34)) QuotationMarks = QuotationMarks + UBound(arrQuotations) If QuotationMarks Mod 2 <> 0 Then ErrorCount = ErrorCount + 1 BlockErrorCount = BlockErrorCount + 1 sOutput = sOutput + "Line #" & CStr(LineCount) & ":" & vbTab & CStr(BlockErrorCount) & "." & vbTab & "Uneven amount of quotation marks.
    " End If End If QuotationMarks = 0 Next CloseCurrentBlock Dim sColor if ErrorCount > 0 Then sColor = "red" Else sColor = "green" End if sOutput = sOutput + "
    <----------------->" sOutput = sOutput + " Total Errors = " & CStr(ErrorCount) & "" sOutput = sOutput+ " <----------------->
Yay i enlarged this :)

Online Shidobu

  • Level 7 Expert
  • *****
  • Posts: 359
  • Making Scripts Today... But Burning You Tomorrow..
    • SDD Coding Community
Re: checkscript
« Reply #1 on: April 28, 2010, 01:49:39 AM »
Thats the old verison use this.
check.eventscripts.com

Offline Grim Reaper

  • Level 7 Expert
  • *****
  • Posts: 167
  • WCS Coding helper :)
Re: checkscript
« Reply #2 on: April 28, 2010, 01:53:55 AM »
If u want my Ratchet & Clank race add my steam {HK}Reaper and if that doesn't work try Jccl98 and if that doesn't work PM me
« Last Edit: April 28, 2010, 02:16:39 AM by Grim Reaper »
Yay i enlarged this :)

Offline Grim Reaper

  • Level 7 Expert
  • *****
  • Posts: 167
  • WCS Coding helper :)
Re: checkscript
« Reply #3 on: April 28, 2010, 02:12:40 AM »
The check script works i changed the code a bit and it says NO ERRORS so yes i am going to remove my post with my race on it xD
Yay i enlarged this :)

Online X510

  • Level 5 Trained Intermediate
  • *****
  • Posts: 104
  • intermediate wcs coder
    • G2X Website
Re: checkscript
« Reply #4 on: April 28, 2010, 02:44:20 AM »
good thing i copied it >.<

ADD ME ON STEAM yyzwtf
ADD ME ON XFIRE X510
ADD ME ON FACEBOOK X510's facebook

Offline Grim Reaper

  • Level 7 Expert
  • *****
  • Posts: 167
  • WCS Coding helper :)
Re: checkscript
« Reply #5 on: April 28, 2010, 02:48:18 AM »
Lol that is the file from the old version so it probably doesn't work :P
Yay i enlarged this :)

Online X510

  • Level 5 Trained Intermediate
  • *****
  • Posts: 104
  • intermediate wcs coder
    • G2X Website
Re: checkscript
« Reply #6 on: April 28, 2010, 02:54:23 AM »
you sir underestimate my abilities of race coding....

ADD ME ON STEAM yyzwtf
ADD ME ON XFIRE X510
ADD ME ON FACEBOOK X510's facebook

Offline Grim Reaper

  • Level 7 Expert
  • *****
  • Posts: 167
  • WCS Coding helper :)
Re: checkscript
« Reply #7 on: April 28, 2010, 04:43:42 AM »
What ability's ??? Anyways if anyone wants my 3 of my custom races no errors just checked pm me or add my steam {HK}Reaper and i that doesn't work try Jccl98
Yay i enlarged this :)