forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


First One To Post Some Code ;)

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 2 Source Code
View previous topic :: View next topic  
Author Message
SuperCharlie
Newbie


Joined: 24 Apr 2002
Posts: 21
Location: Beaumont, Tx

PostPosted: Sun Apr 28, 2002 3:15 am    Post subject: First One To Post Some Code ;) Reply with quote

This is a program I wrote as a launcher for Jedi Knight's dedicated server. It prolly wont be of too much use by itslef to anyone, but as snippets, it may be handy. This program, by the way, has had around 500 downloads in the last 2 weeks Wink It also uses CmdNet.exe for some IP juggling. It was created and compiled in VDS 2.21 and may be a little sloppy, I just figgered itd be a shame for no 2.x code to be up here.. Wink

Code:

title Jedi Outcast Dedicated Server Launcher v1.51
DIALOG CREATE,Jedi Outcast Dedicated Server Launcher v1.51,-1,0,594,536,-
  STYLE(STYLE2;Arial;8;B),-
  STYLE(STYLE1;Arial;10;B),-
  EDIT(servername;12;132;;;Jedi Knight Dedicated),-
  TEXT(servernametext;14;58;88;;Server Name;STYLE2),-
  EDIT(motd;40;132;;;May The Force Be With You),-
  TEXT(motdtext;44;12;;;Message Of The Day;STYLE2),-
  TEXT(broadcasttxt2;270;46;74;;(No for lan only)),-
  RADIO(broadcastradio;210;28;122;56;Broadcast To Internet?;Yes|No;Yes),-
  COMBO(gametypecombo;72;132;;;Free For All;CLICK),-
  TEXT(gametypetxt;76;68;;;Game Type;STYLE2),-
  TEXT(maxplayerstxt;176;24;;;Max Players;STYLE2),-
  RADIO(mapcycleradio;208;334;104;82;Auto Cycle Maps?;Yes|No|Custom;Yes;CLICK),-
  EDIT(maxplayersedit;150;32;50;20;8),-
  TEXT(fraglimittxt;176;208;;;Frag Limit;STYLE2),-
  TEXT(inactivitytxt;176;474;;;Inactivity Kick;STYLE2),-
  TEXT(timelimittxt;176;116;;;Time Limit;STYLE2),-
  TEXT(capturelimittxt;176;382;;;Capture Limit;STYLE2),-
  EDIT(timelimitedit;150;122;50;20;20),-
  RADIO(allowvoteradio;210;258;70;56;Allow Vote?;Yes|No;Yes),-
  EDIT(capturelimitedit;150;394;50;20;20),-
  EDIT(fraglimitedit;150;210;50;20;20),-
  EDIT(inactivityedit;150;484;50;20;120),-
  BUTTON(launchbutton;484;372;110;26;Launch Server;STYLE1),-
  TEXT(inactivitytxt2;188;484;;;(Seconds)),-
  TEXT(mapstxt;108;42;100;20;Beginning Map;STYLE2),-
  RADIO(passwordradio;210;442;110;56;Game Password?;Yes|No;No),-
  EDIT(passwordedit;270;442;108;;Password),-
  TEXT(consolepwdtxt;16;318;;;Console Password;STYLE2),-
  EDIT(consolepwdedit;12;426;150;;conpass),-
  COMBO(mapcombo;104;132;;;ffa_deathstar),-
  LIST(mapselectlist;320;72),-
  LIST(mapslist;320;332),-
  BUTTON(addmapbutton;352;260;;;Add=>),-
  BUTTON(removemapbutton;378;260;;;<=Remove),-
  RADIO(lightsaberradio;210;154;98;56;Light Saber Only?;Yes|No;No),-
  TEXT(forcepowertxt;108;346;;;Force Power Level;STYLE2),-
  COMBO(forcepowercombo;104;462;114;;Jedi),-
  BUTTON(lastsetupbutton;484;94;132;;Launch Last Setup;STYLE1),-
  EDIT(duellimitedit;150;300;52;20;10),-
  TEXT(duellimittxt;176;282;82;;Duel Frag Limit;STYLE2),-
  EDIT(ipedit;40;426;150),-
  TEXT(ipaddytxt;44;360;;;IP Address;STYLE2),-
  EDIT(portedit;70;428;148;;28070),-
  TEXT(porttxt;72;394;26;;Port;STYLE2)

rem #########Setup#############
%s = @regread(LOCAL,Software\jk2dedlauncher,configpath)
if @null(%s)
info This is the one time setup deal. In the next step select the  ::Star Wars JK II Jedi Outcast:: folder.

%t = @dirdlg(Where's Jedi Knight Installed?-One Time Setup)
%v = %t
%t = %t\GameData\base
%v = %v\Gamedata
%t = @shortname(%t)
%v = @shortname(%v)
REGISTRY  WRITE, LOCAL,  Software\jk2dedlauncher,  configpath,  %t
REGISTRY  WRITE, LOCAL,  Software\jk2dedlauncher,  exepath,  %v
end

rem #########Start#############
%s = @regread(LOCAL,Software\jk2dedlauncher,configpath)
%w = @regread(LOCAL,Software\jk2dedlauncher,exepath)


LIST 1, CREATE
LIST 2, CREATE
LIST 3, CREATE



rem #########Fill Lists#############
LIST  gametypecombo, ADD,  Free For All
LIST  gametypecombo, ADD,  Duel
LIST  gametypecombo, ADD,  Capture the Flag
LIST  gametypecombo, ADD,  Jedi Master
LIST  gametypecombo, ADD,  Holocron
LIST  gametypecombo, ADD,  Team Free For All
LIST  gametypecombo, ADD,  Capture the Ysalimari

LIST  mapcombo, ADD,  duel_bay
LIST  mapcombo, ADD,  duel_carbon
LIST  mapcombo, ADD,  duel_jedi
LIST  mapcombo, ADD,  duel_pit
LIST  mapcombo, ADD,  ffa_bespin
LIST  mapcombo, ADD,  ffa_deathstar
LIST  mapcombo, ADD,  ffa_imperial
LIST  mapcombo, ADD,  ffa_ns_hideout
LIST  mapcombo, ADD,  ffa_ns_streets
LIST  mapcombo, ADD,  ffa_raven
LIST  mapcombo, ADD,  ffa_yavin
LIST  mapcombo, ADD,  ctf_bespin
LIST  mapcombo, ADD,  ctf_imperial
LIST  mapcombo, ADD,  ctf_ns_streets
LIST  mapcombo, ADD,  ctf_yavin

LIST  mapselectlist, ADD,  duel_bay
LIST  mapselectlist, ADD,  duel_carbon
LIST  mapselectlist, ADD,  duel_jedi
LIST  mapselectlist, ADD,  duel_pit
LIST  mapselectlist, ADD,  ffa_bespin
LIST  mapselectlist, ADD,  ffa_deathstar
LIST  mapselectlist, ADD,  ffa_imperial
LIST  mapselectlist, ADD,  ffa_ns_hideout
LIST  mapselectlist, ADD,  ffa_ns_streets
LIST  mapselectlist, ADD,  ffa_raven
LIST  mapselectlist, ADD,  ffa_yavin
LIST  mapselectlist, ADD,  ctf_bespin
LIST  mapselectlist, ADD,  ctf_imperial
LIST  mapselectlist, ADD,  ctf_ns_streets
LIST  mapselectlist, ADD,  ctf_yavin

LIST forcepowercombo, add, Disable
LIST forcepowercombo, add, Initiate
LIST forcepowercombo, add, Padawan
LIST forcepowercombo, add, Jedi
LIST forcepowercombo, add, Jedi Adept
LIST forcepowercombo, add, Jedi Guardian
LIST forcepowercombo, add, Jedi Knight
LIST forcepowercombo, add, Jedi Master

rem #########Ip Set#############
%v = %0
%v = @path(%v)
%v = @shortname(%v)
%v = %vcmdnet.exe /f%vip.txt /p

runz %v, wait
%v = %0
%v = @path(%v)
%v = @shortname(%v)
list 3, loadfile, %vip.txt
%v = @item(3)
dialog set, ipedit, %v

:evloop
  wait event
  goto @event()

:gametypecomboCLICK
%v = @dlgtext(gametypecombo)
if @equal(%v,Duel)
dialog set, fraglimitedit, 1
end
goto evloop

:ipcfgbuttonBUTTON
shell open, ipconfig
goto evloop

:addmapbuttonBUTTON
%n = @dlgtext(mapselectlist)
if @null(%n)
info Pick a map to add
else
dialog set,mapcombo,Custom Cycle
dialog set, mapcycleradio, Custom
%n = @dlgtext(mapselectlist)
LIST  mapslist, ADD,  %n
end
goto evloop


:removemapbuttonBUTTON
%n = @dlgtext(mapslist)
if @null(%n)
info Pick a map to remove
else
LIST  mapslist, DELETE
end
goto evloop

:mapcycleradioCLICK
%k = @dlgtext(mapcycleradio)
if @equal(%k,Yes)
dialog set,mapcombo,ffa_deathstar
end
if @equal(%k,No)
dialog set,mapcombo,ffa_deathstar
end
if @equal(%k,Custom)
dialog set,mapcombo,Custom Cycle
end
goto evloop


:launchbuttonBUTTON
rem #########Basic Setup#############
list 1, add, // Server Config
%v = @dlgtext(servername)
list 1, add, seta sv_hostname @CHR(34)%v@CHR(34)
%v = @dlgtext(motd)
list 1, add, seta g_motd @CHR(34)%v@CHR(34)
list 1, add, seta g_warmup 0
list 1, add, seta g_doWarmup 1
list 1, add, seta g_warmup 1
list 1, add, seta sv_minPing 0
list 1, add, seta sv_maxPing 0
list 1, add, seta sv_floodProtect 1
list 1, add, seta g_logfile 3 // 0=None, 1=Buffered, 2=Continuous, 3=Append
list 1, add, seta g_log @CHR(34)games.log@CHR(34) // Default location is ~/.jkii/base/
list 1, add, seta g_logSync 1 // 1=Write complete lines
list 1, add, seta g_statLog 0 // Probably similar to g_logfile. Untested.
list 1, add, seta g_statLogFile @CHR(34)stats.log@CHR(34)


rem #########Game Type#############
%v = @dlgtext(gametypecombo)
if @equal(%v,Free For All)
%v = 0
end

if @equal(%v,Holocron)
%v = 1
end

if @equal(%v,Jedi Master)
%v = 2
end

if @equal(%v,Duel)
%v = 3
end

if @equal(%v,Team Free For All)
%v = 5
end

if @equal(%v,Capture the Flag)
%v = 7
end

if @equal(%v,Capture the Ysalimari)
%v = 8
end

list 1, add, seta g_gametype %v

rem #########Game Password#############
%v = @dlgtext(passwordradio)
if @equal(%v,Yes)
%v = @dlgtext(passwordedit)
list 1, add, seta g_password @CHR(34)%v@CHR(34)
else
list 1, add, seta g_password @CHR(34)@CHR(34)
end
end

rem #########Max Players#############
%v = @dlgtext(maxplayersedit)
list 1, add, seta sv_maxclients %v

rem #########Timelimit#############
%v = @dlgtext(timelimitedit)
list 1, add, seta timelimit %v

rem #########Capture Limit#############
%v = @dlgtext(capturelimitedit)
list 1, add, seta capturelimit %v

rem #########Frag Limit#############
%v = @dlgtext(fraglimitedit)
list 1, add, seta fraglimit %v

rem #########inactivity Kick#############
%v = @dlgtext(inactivityedit)
list 1, add, seta g_inactivity %v

rem #########Console Password#############
%v = @dlgtext(consolepwdedit)
list 1, add, seta rconpassword @CHR(34)%v@CHR(34)

rem #########Duel Fraglimit#############
%v = @dlgtext(duellimitedit)
list 1, add, seta duel_fraglimit %v

rem #########Force Power Level#############
%v = @dlgtext(forcepowercombo)
if @equal(%v,disable)
%v = 0
end
if @equal(%v,Initiate)
%v = 1
end
if @equal(%v,Padawan)
%v = 2
end
if @equal(%v,Jedi)
%v = 3
end
if @equal(%v,Jedi Adept)
%v = 4
end
if @equal(%v,Jedi Guardian)
%v = 5
end
if @equal(%v,Jedi Knight)
%v = 6
end
if @equal(%v,Jedi Master)
%v = 7
end

if @equal(%v,0)
list 1, add, seta g_forcePowerDisable 32767
list 1, add, seta g_maxForceRank 0
else
list 1, add, seta g_forcePowerDisable 0
list 1, add, seta g_maxForceRank %v
end


rem #########Saber Only #############
%v = @dlgtext(lightsaberradio)
if @equal(%v,Yes)
list 1, add, seta g_duelWeaponDisable 65531
list 1, add, seta g_weaponDisable 65531
else
list 1, add, seta g_duelWeaponDisable 0
list 1, add, seta g_weaponDisable 0
end



rem #########Vote #############
%v = @dlgtext(allowvoteradio)
if @equal(%v,Yes)
list 1, add, seta g_allowvote 1
else
list 1, add, seta g_allowvote 0
end


rem ########## Maps ###########
%k = @dlgtext(mapcycleradio)
rem #########Autocycle Yes ########
if @equal(%k,Yes)
list 1, add, seta g_autoMapCycle 1
%o = @dlgtext(mapcombo)
list 1, add, map %o
end

rem #########Autocycle No ########
if @equal(%k,No)
list 1, add, seta g_autoMapCycle 0
%o = @dlgtext(mapcombo)
list 1, add, map %o
end


rem #########Autocycle Custom ########
if @equal(%k,Custom)
list 1, add, // Map Rotation

rem ###last record####
%z = @count(mapslist)
if @equal(%z,0)
info Add Maps For Custom Rotation
goto evloop
end

%z = @diff(%z, 2)

rem ###current record###
%w = 0
%w = @diff(%w,1)

rem ###current map###
%y = 0

rem ###next map###
%x = 1


repeat
%w = @sum(%w,1)
%y = @sum(%y,1)
%x = @sum(%x,1)
list mapslist, seek, %w
%v = @dlgtext(mapslist)
list 1, add, set d%y @CHR(34)map @dlgtext(mapslist) ; set nextmap vstr d%x@CHR(34)
until @equal(%w,%z)

%w = @sum(%w,1)
%y = @sum(%y,1)
%x = @sum(%x,1)
list mapslist, seek, %w
%v = @dlgtext(mapslist)
list 1, add, set d%y @CHR(34)map @dlgtext(mapslist) ; set nextmap vstr d1@CHR(34)
list 1, add, //set the start map
list 1, add, vstr d1

end

%s = @regread(LOCAL,Software\jk2dedlauncher,configpath)
%w = @regread(LOCAL,Software\jk2dedlauncher,exepath)
rem #########Save Config File########
list 1, savefile, %s\jk2ded.cfg

%p = @dlgtext(portedit)
%i = @dlgtext(ipedit)

rem #########Save Batch Files########
%v = @dlgtext(broadcastradio)
if @equal(%v,Yes)
list 2, add, jk2ded.exe +set dedicated 2 +set net_port %p +set net_ip %i +set net_noudp 0 +set net_noipx 1 +exec jk2ded.cfg
else
list 2, add, jk2ded.exe +set dedicated 1 +set noudp 0 +set net_noipx 1 +exec jk2ded.cfg
end
list 2, savefile, %w\jk2ded.bat
wait 1
DIRECTORY CHANGE,%w
run jk2ded.bat

:CLOSE
   exit

:lastsetupbuttonBUTTON
DIRECTORY CHANGE,%w
run jk2ded.bat
exit
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 2 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group