• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Save Code in txt file

Status
Not open for further replies.
Level 20
Joined
Jul 12, 2010
Messages
1,717
Hi guys I need help with something a bit confusing because it's in jass and I'm mostly GUIer>_>
I know maps using SaveLoad Systems can save the codes in a txt file in WC3 directory using Preload.

After searching a bit I found this thread and I followed the steps.

This is my Map Header:
JASS:
function CreateTextFile takes nothing returns nothing
    local integer p = GetPlayerId(GetTriggerPlayer())+1
    local string heroName = GetUnitName(udg_Player_Hero)
    local integer heroLevel = GetHeroLevel(udg_Player_Hero)
   
    call PreloadGenClear()
    call PreloadGenStart()
   
    // The line below creates the log
    // Right now, this is:
    //      Hero: (hero name)
    //      Level: (hero level)
    //      Code: -load XXXX
    call Preload("\r\n\t\t\t\tHero: " + heroName + "\r\n\t\t\t\t" + "Level: " + I2S(heroLevel) + "\t\t\r\n\t\t\t\t" + "Code: -load " + udg_SaveLoad_Code[15] + "\r\n\n\t\t    ")
   
    // The line below creates the file at the specified location
    // Right now, this is:
    //      "Warcraft III\MapName\(hero name) - (hero level)"
    call PreloadGenEnd("PerfectWorld\\" + heroName + " - " + I2S(heroLevel) + ".txt")
endfunction
and this is the end of my Save trigger:
  • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: |c00959697Your code...
  • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: (-load |c00FEBA0E + SaveLoad_Code[15])
  • Custom script: call CreateTextFile()
(the rest of the trigger was skipped for privacy reasons)


I copied everything and changed the variables and I compiled the code without any problems.


However the problem is when I save the code it doesn't create the txt file in my WC3 Directory =/
saveload-jpg.303235

So does anybody know what I'm doing wrong here?

One thought I had is that it might be due to latest trigger updates, because that post I found was from 2013...
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
Security issues were 'fixed' in 1.24 after that thread, so it could be that, or it might be because of directory changes for maps? They used to all be in c:\Program Files\Warcraft III back in 2013, but are stored in the user's documents. It looks to me like you've implemented it correctly
 
Status
Not open for further replies.
Top