找回密码
 点一下
查看: 1543|回复: 1

求助如何将魔兽中字符串变量的值导出到txt文件

[复制链接]
发表于 2012-8-14 22:06:04 | 显示全部楼层 |阅读模式
如标题所示,
下面真三AR模式锁定种子的测试代码:
=====================================================================================
//TESH.scrollpos=36
//TESH.alwaysfold=0
function Trig_Allrandom_Func008002 takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Trig_Allrandom_Func009Func003001 takes nothing returns boolean
return (udg_RandomHero_TypeList[udg_x]!=0)
endfunction
function Trig_Allrandom_Func009Func008002 takes nothing returns nothing
call SetPlayerTechMaxAllowedSwap(udg_RandomHero_TypeList[udg_x],0,GetEnumPlayer())
endfunction
function Trig_Allrandom_Func010Func003001 takes nothing returns boolean
return (udg_RandomHero_TypeList[udg_x]!=0)
endfunction
function Trig_Allrandom_Func010Func008002 takes nothing returns nothing
call SetPlayerTechMaxAllowedSwap(udg_RandomHero_TypeList[udg_x],0,GetEnumPlayer())
endfunction
function Trig_Allrandom_Actions takes nothing returns nothing
  local integer loopi
  local string displaytext
  local integer abc
call DisableTrigger(GetTriggeringTrigger())
call RemoveUnit(gg_unit_n00Z_0200)
call RemoveUnit(gg_unit_n001_0198)
call RemoveUnit(gg_unit_n01B_0203)
call RemoveUnit(gg_unit_n00B_0201)
call RemoveUnit(gg_unit_n00Y_0205)
call RemoveUnit(gg_unit_n000_0199)
call ForGroupBJ(GetUnitsOfTypeIdAll('h000'),function Trig_Allrandom_Func008002)
   
    set loopi=1
    //set udg_TextResult=""
  loop
    exitwhen loopi>50
    set udg_RandomHero_TypeList[1]='E000'
    set udg_RandomHero_TypeList[2]='E003'
    set udg_RandomHero_TypeList[3]='O003'
    set udg_RandomHero_TypeList[4]='O002'
    set udg_RandomHero_TypeList[5]='O00K'
    set udg_RandomHero_TypeList[6]='O000'
    set udg_RandomHero_TypeList[7]='U002'
    set udg_RandomHero_TypeList[8]='Hvwd'
    set udg_RandomHero_TypeList[9]='U006'
    set udg_RandomHero_TypeList[10]='E004'
    set udg_RandomHero_TypeList[11]='H01P'
    set udg_RandomHero_TypeList[12]='Hamg'
    set udg_RandomHero_TypeList[13]='U00J'
    set udg_RandomHero_TypeList[14]='H004'
    set udg_RandomHero_TypeList[15]='H003'
    set udg_RandomHero_TypeList[16]='H01G'
    set udg_RandomHero_TypeList[17]='N00P'
    set udg_RandomHero_TypeList[18]='U00D'
    set udg_RandomHero_TypeList[19]='H008'
    set udg_RandomHero_TypeList[20]='N00W'
    set udg_RandomHero_TypeList[21]='N004'
    set udg_RandomHero_TypeList[22]='U00A'
    set udg_RandomHero_TypeList[23]='U00I'
    set udg_RandomHero_TypeList[24]='U000'
    set udg_RandomHero_TypeList[25]='H006'
    set udg_RandomHero_TypeList[26]='H005'
    set udg_RandomHero_TypeList[27]='H010'
    set udg_RandomHero_TypeList[28]='N005'
    set udg_RandomHero_TypeList[29]='H00I'
    set udg_RandomHero_TypeList[30]='H012'
    set udg_RandomHero_TypeList[31]='O00P'
    set udg_RandomHero_TypeList[32]='U007'
    set udg_RandomHero_TypeList[33]='Ucrl'
    set udg_RandomHero_TypeList[34]='E00C'
    set udg_RandomHero_TypeList[35]='E005'
    set udg_RandomHero_TypeList[36]='E006'
    set udg_RandomHero_TypeList[37]='E00J'
    set udg_RandomHero_TypeList[38]='U00O'
    set udg_RandomHero_TypeList[39]='N010'
    set udg_RandomHero_TypeList[40]='U00N'
set bj_forLoopAIndex=2
set bj_forLoopAIndexEnd=6
    call SetRandomSeed(loopi)
    set abc=GetRandomInt(1,40)
    set abc=GetRandomInt(1,40)
    set abc=GetRandomInt(1,40)
    set displaytext="seed"+I2S(loopi)+":"
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
loop
set udg_x=GetRandomInt(1,40)
if (Trig_Allrandom_Func009Func003001()) then
exitwhen true
endif
endloop
set udg_Temp_Point=GetRectCenter(gg_rct_SHU_TavernsRect)
call CreateNUnitsAtLoc(1,udg_RandomHero_TypeList[udg_x],Player(-1+(bj_forLoopAIndex)),udg_Temp_Point,bj_UNIT_FACING)
call RemoveLocation(udg_Temp_Point)
call ForForce(bj_FORCE_ALL_PLAYERS,function Trig_Allrandom_Func009Func008002)
      set displaytext=displaytext+" "+I2S(udg_x)
set udg_RandomHero_TypeList[udg_x]=0
set bj_forLoopAIndex=bj_forLoopAIndex+1
      call RemoveUnit(GetLastCreatedUnit())
endloop
    set displaytext=displaytext+"  "
set bj_forLoopAIndex=8
set bj_forLoopAIndexEnd=12
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
loop
set udg_x=GetRandomInt(1,40)
if (Trig_Allrandom_Func010Func003001()) then
exitwhen true
endif
endloop
set udg_Temp_Point=GetRectCenter(gg_rct_WEI_TavernsRect)
call CreateNUnitsAtLoc(1,udg_RandomHero_TypeList[udg_x],Player(-1+(bj_forLoopAIndex)),udg_Temp_Point,bj_UNIT_FACING)
call RemoveLocation(udg_Temp_Point)
call ForForce(bj_FORCE_ALL_PLAYERS,function Trig_Allrandom_Func010Func008002)
      set displaytext=displaytext+" "+I2S(udg_x)
set udg_RandomHero_TypeList[udg_x]=0
set bj_forLoopAIndex=bj_forLoopAIndex+1
      call RemoveUnit(GetLastCreatedUnit())
endloop
    set displaytext=displaytext+"\n"
    call DisplayTimedTextToForce( GetPlayersAll(), 180, displaytext)
    set udg_TextResult=udg_TextResult+displaytext
    set loopi=loopi+1
  endloop
endfunction
//===========================================================================
function InitTrig_Allrandom takes nothing returns nothing
set gg_trg_Allrandom=CreateTrigger()
call TriggerRegisterPlayerChatEvent(gg_trg_Allrandom,Player(1),"-ar",true)
call TriggerAddAction(gg_trg_Allrandom,function Trig_Allrandom_Actions)
endfunction
==========================================================================================================
在游戏开始后输入-ar,50组AR英雄种子数据信息完全存储在字符串变量udg_TextResult(全局变量)中。
这个字符串变量udg_TextResult可以在游戏中用War3JassDebug软件监视得到字符串变量值,但是不能导出到文件,貌似JASS中也没有直接导出变量值到文件的函数。求高手解决。。。
此问题解决后 以后AR锁定种子我可以公开让大家利用了。
注:能在JASS代码中解决是最好了,不过如果你能用其它语言编程 利用Windows API调用war3的进程,然后搜索内存地址,得出变量值也可,但是我不会。

=====================================================================================================
发表于 2012-8-15 09:40:50 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-12-22 16:07 , Processed in 0.242509 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表