UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[Tutorial] Developer Script Playback

broken avatar :(
Created 11 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
4,853 views
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Developer Script playback.

Allows for in-game tracking and debugging of scripts by print an array of strings to the in-game console. Playback printed in the console is whatever has been added to that playback script at that point in time.

This script requires that your map works with developer and developer_script set to their max values. DO NOT remove the developer /# #/, they are there for a reason.

Changelog(V1.4):
-Removed secondary var, reducing script overhead in half.
-Removed dev_assert.
-Removed "extras" parameter.
-Added developer comment blocks on dev_dvar_playback() function.
-Changed check for whether level.playback is defined from throwing an error to just creating the requested playback script.

Code Snippet
Plaintext
/*
Developer Script Playback
Version: 1.4
Tracks in-game scripted events
ONLY FOR DEVELOPER MODE

Scripted by BlueSoviet

***HOW TO USE THIS SCRIPT***
Function args(All are strings!):

Script - the unique name of the script you want to/have added.
Playback - the string you want added to the specific playback script.

1. Create a playback array by calling:
dev_create_playback(script);

2. Add a string to your playback script by using:
dev_add_playback(<script>, <something to add>); wherever you want to add a string
to the specific playback array.

3. Launch your map with developer and developer_script set to their max values,
then while in-game set the dvar "dev_playback" to the script you want to print
to the console(Doesn't show in the top-left area).
*/

#include maps\_utility;
#include common_scripts\utility;

dev()
{
/#
if(isDefined(level.playback))
assertMsg("Playback init function already called!");

level.playback = [];

SetDvar( "dev_playback", "" );
thread dev_dvar_playback();
#/
}
dev_dvar_playback()
{
/#
if(!isDefined(level.playback))
assertMsg("Dev function must be called first!");

while(1)
{
cmd = getdvar("dev_playback");
if(isdefined(level.playback[cmd]))
dev_print_playback(cmd);
SetDvar("dev_playback", "");
wait(.1);
}
#/
}

dev_create_playback(script)
{
/#
if(!isDefined(level.playback))
assertMsg("Dev function must be called first!");

level.playback[script] = [];
level.playback[script][0] = "***DEV SCRIPT PLAYBACK INIT***";
level.playback[script][1] = "DEV SCRIPT: "   script;
#/
}
dev_add_playback(script, playback)
{
/#
if(!isDefined(level.playback))
assertMsg("Dev function must be called first!");

if(!isdefined(level.playback[script]))
dev_create_playback(script);

level.playback[script][level.playback[script].size] = playback;
#/
}
dev_print_playback(script)
{
/#
if(!isDefined(level.playback))
assertMsg("Dev function must be called first!");

if(!isdefined(level.playback[script]))
dev_create_playback(script);

println("Script Playback Size: "   level.playback[script].size);

for(i=0;i<level.playback[script].size;i  )
println("Playback "   i   ": "   level.playback[script][i]);
#/
}

Last Edit: May 09, 2016, 03:47:58 am by daedra descent
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Updated script to V1.1 - now includes the "extra" option which adds extra playback scripts for vars, ints, and dvars so you don't need to put them into one array and also adds dev_assert() which will add whatever playback you want before doing assertmsg().
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
I was actually writing something like this last night before i ran out of time. This will save me some work :)
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
I was actually writing something like this last night before i ran out of time. This will save me some work :)

If your planning on using this for something other than debug then please don't. If this script is active while someone is playing the map and their on a really high round you could have arrays with literally 1000's of values. I don't know if WaW has a limit on how big an array can be, but even if it doesn't, adding that many values can't be good. ONLY RUN THIS IN DEVELOPER!
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
I did not intend to?
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
I did not intend to?

Just making sure.  ;)

broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
fair enough :)
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Updated to V1.4:

Changelog:
-Removed secondary var, reducing script overhead in half.
-Removed dev_assert.
-Removed "extras" parameter.
-Added developer comment blocks on dev_dvar_playback() function.
-Changed check for whether level.playback is defined from throwing an error to just creating the requested playback script.

 
Loading ...