var and text

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

var and text

Post by ViPER »

Can i put string of text in a var?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You mean read from a file?
Image
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

no, im making a global.scr and i want to send text to message threads,
scoreboard and hud
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You could make an array of strings...
Image
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

ok, im using the constant array like this -

local.t = this::is::a::test

iprintln local.t[1] " " local.t[2] " " local.t[3] " " local.t[4]

and it works in its own thread but how do i get it to the global.scr
I get nil nil nil nil

i tried -
local.t = this::is::a::test
setcvar testpass local.t
exec global/testing.scr

///////and in global

local.t = (int(getcvar testpass))
iprintln local.t[1] " " local.t[2] " " local.t[3] " " local.t[4]

result is nil nil nil nil
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Try

local.t = this::is::a::test
exec global/testing.scr local.t

///////and in global

main local.t:
iprintln local.t[1] " " local.t[2] " " local.t[3] " " local.t[4]
end

result is this is a test
Image
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

Cool!! TY
User avatar
diego
Captain
Posts: 245
Joined: Sun Dec 21, 2003 10:47 pm

Post by diego »

Is this to have the console automatically print messages in the game? If so, could you give me a "Global for Dummies" version of those instructions?

I'm finally getting some custom maps on our server and I want it to regularly nag the players to download the new maps from our website.

But I've never done any server admin stuff before nor messed with any global scripting.
Diego
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

make a global.scr - call it something like

myglobalstuff.scr

in all your map .scrs add this line just above the level waittil spawn

Code: Select all

exec global/myglobalstuff.scr
put this in myglobalstuff.scr

Code: Select all

main:
thread messages
end

messages:
while(1)
{
wait 300
iprint "get the custom map paks you big dummies they are free !"
}
end
and make sure you put this in global folder

the cool thing is when you want to add something to all your maps -

now you need just to do it once - thread it from the main.
User avatar
diego
Captain
Posts: 245
Joined: Sun Dec 21, 2003 10:47 pm

Post by diego »

Thanks. I was hoping I wouldn't have to edit each individual map script. Can I just make copies of the original map scripts and not edit the ones in the pk3 files? Will the copies have priority over the originals?
Diego
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

ive seen stock map script available for download somewhere... cant remember? anyways.. if you cant find them look in pak5.pk3 for aa.
extract the ones you want and file them like so -

maps/dm
maps/obj
global

then put them in your own pk3 and name them something like -

zzzzz-mymods.pk3

then they will load last.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

ive seen stock map script available for download somewhere... cant remember
all stock map scripts are in the pak files, otherwise the maps wont work.
HOWEVER: i just learned today that noobux, er, linux, loads pk3 files backwards. while hopefully not many server are cursed with such an OS, you'll want to make a Linux version for the people who dont use Windows.

aaa_myModName.pk3 - Linux
zzz_myModName.pk3 - Windows
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

They do work. what i mean is that someone (cant remember where) had
the scripts (unedited) all prepared in a user-pak ready to mod.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

i meant the server needs the scripts, clients dont need anything but the map. scripts dont need to be distributed either ;)
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

thats correct. He wants to mod for his server.
Post Reply