Jump to content
  • 0

script doesn't execute


zzzornbringer

Question

i have sort of a global script file (called "c_script") that i put in my wad as a text entry. i use the #include command to access it in all of my maps. it is triggered via a "actor enters sector" thing and works just fine. the script basically teleports me into a random map:

 

script 80 (void)
{
int levelinfo = GetLevelInfo(LEVELINFO_LEVELNUM);
int random_map;
while(true)
{
random_map=random(1,6);
if(random_map != levelinfo)
{
Teleport_NewMap(random_map,0,0);
}
delay(1);
}

}

works perfectly fine.

 

now i added another script into this file:

 

script 81 enter
{
while(true)
{
HudMessage(s:"You have ", i:CheckInventory("spacebucks"), s:" spacebucks"; HUDMSG_PLAIN, 0, CR_GREEN, 0.0 , 0.1, 0.1);
delay(35/10);
}
}

it should execute whenever i enter a map and display a hud message. but it simply won't work. it doesn't put out an error either. it works when i put this code into the individual maps script, but i'd have to repeat this for every map which i really want to avoid if possible.

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0
5 hours ago, zzzornbringer said:

can you try moving the second script into the first? Or maybe create a 2nd #include

 

Share this post


Link to post
  • 0

well, i did a bit of testing and there's something really weird going on.

 

firstly, the global script files won't get properly updated when i change something and then launch one of the maps. i have to remove the "#include" line from the map, save, re-enter the line, save, and then it will execute the updated global script that i have in the wad.

 

like for example, i have modified the hudmessage to be displayed at a different location. even though all of the maps should access the exact same script and therefore should have all the messages shown at the same location, only the map where i have done the procedure above show the correct position. all of the other maps still show the old position. so, the script is not updated for whatever reason. and there is nothing else in the wad. i feel like i'm getting insane.

Share this post


Link to post
  • 0

i don't know if it's related since i'm bad with scripts, but could you try change the code from delay(35/10); to delay(10); and then see if the scripts work?

Share this post


Link to post
  • 0

nah, that's not the problem. i can't really tell for sure, but it works, even though delay required an integer value and 35/10 obviously doesn't return this. maybe there's some rounding?

 

anyways, i've managed to make this work now. i'm not entirely sure how. perhaps because i manually compiled the script in each map again. usually i don't do this. i just hit save, test the map and this usually works just fine. maybe it needs to be manually compiled, because the script file is not technically part of an individual map, but just an entry in the wad. i don't know, but it works.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...