Page 1 of 1
Why doesn?t it works
Posted: Fri Feb 13, 2004 3:20 pm
by Pollo_Expresss
It?s only a test cause i?m trying to understand scripting and have to start from very down hehe. Well I know it?s a noob question but need help.
Why doesn?t it works?
Code: Select all
// Polk
// ARCHITECTURE: It Polk
// SCRIPTING: Pollo_Expresss
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Polk"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
level.script = maps/dm/Polk.scr
exec global/ambient.scr Polk
level waittill spawn
thread mensage
end
//-----------------------------------------------------------------------------
mensage:
{
local.time = 20
while ( local.time > 0 )
{
iprintlnbold_noloc local.time + " seconds remaining!"
wait 1
local.time = local.time - 1
}
}
end
Triying to use the knowledge adquired with the Bjarne BZR scripting tutorial, that?s why the code is the same that is there in the tutorial.
I?m triying to call a thread but it doesn?t works.
Can I get that kind of scripting in DM maps? or is this only avaliable on SP maps?
Posted: Fri Feb 13, 2004 3:49 pm
by jv_map
Code: Select all
mensage:
{
local.time = 20
while ( local.time > 0 )
{
iprintlnbold_noloc local.time + " seconds remaining!"
wait 1
local.time = local.time - 1
}
}
end
Should be:
Code: Select all
mensage:
local.time = 20
while ( local.time > 0 )
{
iprintlnbold_noloc local.time + " seconds remaining!"
wait 1
local.time = local.time - 1
}
end
Re: Why doesn?t it works
Posted: Fri Feb 13, 2004 4:51 pm
by Rookie One.pl
Yep, and I think this is a little change which might help you a little bit:
Code: Select all
mensage:
local.time = 20
while ( local.time > 0 )
{
iprintlnbold_noloc local.time + " seconds remaining!"
wait 1
local.time--
}
end
If you want to add or subtract 1 from a variable, you can put -- (to subtract) or ++ (to add)

Posted: Fri Feb 13, 2004 9:24 pm
by Pollo_Expresss
It doesn?t work yet. Don?t know what?s the problem.
I running Breakthrough, can that be a problem?
And the map is a DM map, can I script DM maps the same way as SP maps or is another way to script them?
Well thank you for helping guys hope anyone can tell me something more.
use jv_map's
Posted: Sat Feb 14, 2004 11:01 am
by tltrude
Use jv_maps thread.
Also, this line will not work for background sounds.
exec global/ambient.scr Polk
Unless you have made a main/music/Polk.mus file. Try using the background sound for a stock map like this.
exec global/ambient.scr mohdm7
Snif snif snif
Posted: Sat Feb 14, 2004 9:21 pm
by Pollo_Expresss
It still doesn?t works
Well, that?s my case:
I?m running a custom map, it is only a room with a light and an info player start. I only want to test if I can display some messages on screen ?cause if I learn how to do it I will modify my server?s stock maps with some messages like "rockets are not allowed in this server" or just "this is the best server in the world" (hehehe just kidding).
I though about use this thread to get it but it doesn?t works even doing all of those modifications you all told me.
Well I want to thank you TlTrude but it still doesn?t works, do you know something more can be causing this?
I said I running it in Breakthrough ?cause I though about it would be a problem but for your asking I guess it doesn?t matter, isn?t it?
Well thank you again and I hope it isn?t a problem of my computer hehe.
Posted: Sat Feb 14, 2004 10:03 pm
by tltrude
Try this:
Code: Select all
mensage:
wait 10
local.timer = 20
while ( local.timer > 0 )
{
iprintlnbold_noloc local.timer + " seconds remaining!"
wait 1
local.timer = local.timer - 1
}
end
Here is another option.
Code: Select all
mensage:
level.subtitleX = 89
level.subtitleY = 50
level.timer = 20
wait 10
while ( 1)
{
locprint level.subtitleX level.subtitleY ("Countdown: " + (int level.timer) + " seconds" )
wait 1
level.timer = level.timer - 1
if (level.timer == 0)
{
end
}
}
end
Yep, you get it
Posted: Sat Feb 14, 2004 10:42 pm
by Pollo_Expresss
Thanks tltrude this second option you posted is working fine and now I can make my testings changing the text or making stuff from that.
But I have no idea of why the other thread doesn?t works, I guess I have to define some variables or to do anything else and not only write iprintlnbold_noloc "bla bla".
Well don?t know I?m a scripting noob but hope I can start doing things from that. Thank you again to all .map comunity.
I love your altelevator map tutorial tltrude hehehe it is very funny to get down in that tube that is in the top of one of the houses.

vent
Posted: Sat Feb 14, 2004 10:52 pm
by tltrude
I call it a "spiral vent". Players can fall a long way down and not be damaged. People seem to like the crane too.
http://pages.sbcglobal.net/tltrude/Temp/altelevator.zip
More maps here:
http://pages.sbcglobal.net/tltrude/Temp/

Posted: Mon Feb 16, 2004 6:49 pm
by JoeDZ
First off I gotta say how great a site this is, very informative. I've been reading here for the past month while working on my first map.
That said,,, I can't get the test script to work. I based it on this thread, but still getting no response. My map is almost finished and compiles with no errors. here is a copy of my .scr file...
Only thing I can think of is that it's waiting for more than just one player ( myself). I've been testing the map by loading it up with me (console) as the only player on the map. Do I need to have somebody else in here ? or is there something else wrong. As far as I can tell I got everything right.
the map name is dvb for now, both dvb.bsp and dvb.scr are in maps/dm/
// Yourmapname title
// ARCHITECTURE: Who made the map
// SCRIPTING: Who did the scripting
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "test"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none" // your score board picture
level waittill prespawn
exec global/DMprecache.scr
exec global/ambient.scr dvb
// may want to make your own ambient sounds, read the tut
level.script = "maps/dm/dvb.scr"
// remember to put in your map name
level waittill spawn
//add more codes here after you add more features to your maps
thread mensage2
end
// test 2
mensage2:
level.subtitleX = 89
level.subtitleY = 50
level.timer = 20
wait 10
while ( 1)
{
locprint level.subtitleX level.subtitleY ("Countdown2: " + (int level.timer) + " seconds" )
wait 1
level.timer = level.timer - 1
if (level.timer == 0)
{
end
}
}
end
testthread:
centerprint "test 1"
huddraw "testing 2"
end
[/quote]
Posted: Mon Feb 16, 2004 9:26 pm
by Pollo_Expresss
Also, this line will not work for background sounds.
exec global/ambient.scr Polk
Unless you have made a main/music/Polk.mus file. Try using the background sound for a stock map like this.
exec global/ambient.scr mohdm7
tltrude told me that but I think this is not the error that is making your script crash. Well I?m a noob and I probably need more help than you but I noticed too many { and } in your script, that happened to me and it can be your problem too.
mensage2:
level.subtitleX = 89
level.subtitleY = 50
level.timer = 20
wait 10
while ( 1)
{
locprint level.subtitleX level.subtitleY ("Countdown2: " + (int level.timer) + " seconds" )
wait 1
level.timer = level.timer - 1
if (level.timer == 0)
{
end
}
}
think should be
Code: Select all
mensage2:
level.subtitleX = 89
level.subtitleY = 50
level.timer = 20
wait 10
while ( 1)
{
locprint level.subtitleX level.subtitleY ("Countdown2: " + (int level.timer) + " seconds" )
wait 1
level.timer = level.timer - 1
if (level.timer == 0)
}
end
Hope it help you but remember I?m only guessing that ?cause I?m new in that too.
Posted: Mon Feb 16, 2004 9:33 pm
by JoeDZ
okie, thanks, gonna give it a try right now
Nope
Posted: Tue Feb 17, 2004 7:47 am
by tltrude
A while loop keeps going until it is stopped with "end" or gets the "break" command. So, I think JoeDZ had it right. I Do see other problems in the script, though.
This line (level.script = "maps/dm/dvb.scr") should not have quotes.
The thread named "testthread" will probaly crash the script, if it ever gets read.
And, you probably don't have any background sound.
That location (89, 50) is in the lower left of the screen. The lower left corner is (0, 0).
Posted: Wed Feb 18, 2004 8:34 pm
by JoeDZ
Hey guys, thanks for all the help.
I actually discovered the cause of the problem by accident. I came across a thread here which was explaining how you didn't actually have to have a .pk3 file to run the map, just have the .bsp and .src files in /maps/dm in the mainta directory.
I was using /mainta/maps as my map source folder where I was saving all my work. On a guess I renamed that to /devmaps and the map and script works fine. Looks like SH was referencing the .src files in that directory instead of the .pk3 I made. DOH !!!
