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

How do you store Save/Load code in a text document?

Status
Not open for further replies.
Level 8
Joined
Jul 17, 2004
Messages
283
Well I found this. Scroll down to "How can I create txt files via triggers?".
http://www.hiveworkshop.com/forums/tutorial-submission-283/faq-wehz-228993/

But the problem I am having is.
When using CodeGen:
http://www.hiveworkshop.com/forums/spells-569/codegen-1-0-1-a-177395/

The Save code has colors in the letters/numbers, so the text file comes out something like this:
Code:
function PreloadFiles takes nothing returns nothing

	call Preload( "|cff008000M|r|c002a4580a|r|c002a4580h|r|c002a4580a|r-|c002a4580a|r|c002a4580a|r|c002a4580a|r|c002a4580a|r-|c002a4580a|r|c002a4580a|r|c002a4580a|r|c002a4580h|r-|cff008000K|r" )
	call PreloadEnd( 0.0 )

endfunction

How can I get the text document to only utilize the letters/numbers without the colors with the CodeGen system?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
well.. you modify the "code" variable.

  • For each (Integer A) from 1 to (Length of Code), do (Actions)
    • Loop - Actions
      • Set tempCode = (color code + ((Substring(Code, (Integer A), ((Integer A) + 1))) + |r))
I think something like that would work.

edit: oh I see.. the system colors it automatically, that's your issue.

JASS:
function CodeGen_Color takes string char returns string
    local integer i = 0
    local integer l = StringLength(udg_SaveLoad_Full)
    local string x  = ""
    loop
        exitwhen i > l
        set x = SubString(udg_SaveLoad_Full, i, i + 1)
        if char == x then
            if (x=="0" or S2I(x) > 0) then
                return char
            elseif StringCase(x, false) == x then
                return char 
            elseif StringCase(x, true) == x then
                return char
            endif
        endif
        set i = i + 1
    endloop
    return char
endfunction

replace the function with this one.
 
Status
Not open for further replies.
Top