Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » editing scripts.dll
editing scripts.dll [message #235432] Fri, 22 December 2006 11:39 Go to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i need to find a place in scripts.dll 2.92 that is only executed ONCE. for some reason, it is executed 3 times. i have tryed using global variables to stop it executing.
Re: editing scripts.dll [message #235434 is a reply to message #235432] Fri, 22 December 2006 11:47 Go to previous messageGo to next message
Zion is currently offline  Zion
Messages: 2722
Registered: April 2006
Karma: 1
General (2 Stars)
PINFO?

That's executed once per player, just make sure one player is in the server.

ID is also executed once.
Re: editing scripts.dll [message #235435 is a reply to message #235432] Fri, 22 December 2006 11:51 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
im sorry i wasn't very specific.

when the server starts up, i need a place that i executed once. for some reason everwhere i try its executed 3 times. so i can initialize a program.
Re: editing scripts.dll [message #235440 is a reply to message #235432] Fri, 22 December 2006 12:15 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
use a boolean variable to check if its run or not.

static bool hasStarted = false;

if ( !hasStarted )
{
  .....
  hasStarted = true;
}



since it is static you don't need to bother making it global.


http://steamsignature.com/card/1/76561197975867233.png
Re: editing scripts.dll [message #235448 is a reply to message #235432] Fri, 22 December 2006 12:53 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i don't know what is happening but that didnt work.
index.php?t=getfile&id=2201&private=0

index.php?t=getfile&id=2202&private=0


this is really annoying, and i think tmp files is going to be the only answer.
Re: editing scripts.dll [message #235449 is a reply to message #235432] Fri, 22 December 2006 12:56 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
scripts.dll is loaded oncee on server startup, then unloaded and reloaded when starting a game.
Re: editing scripts.dll [message #235451 is a reply to message #235432] Fri, 22 December 2006 12:58 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
so you know how i can detect when it is loaded to start the game?
Re: editing scripts.dll [message #235456 is a reply to message #235432] Fri, 22 December 2006 13:19 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
declare the static bool INSIDE the function, not outside of it Wink

http://steamsignature.com/card/1/76561197975867233.png
Re: editing scripts.dll [message #235461 is a reply to message #235432] Fri, 22 December 2006 13:32 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i tryed it both ways, and still. it gets called twice Dont Get It
Re: editing scripts.dll [message #235478 is a reply to message #235432] Fri, 22 December 2006 14:30 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
Look up interprocess synchronization via mutex.
Re: editing scripts.dll [message #235481 is a reply to message #235432] Fri, 22 December 2006 14:42 Go to previous messageGo to next message
StealthEye is currently offline  StealthEye
Messages: 2518
Registered: May 2006
Location: The Netherlands
Karma: 0
General (2 Stars)

Check whether bhs.dll is already loaded

if (!GetModuleHandle("bhs.dll"))
{
// First time
}

Obviously do this before bhs.dll is loaded in dllmain, as otherwise it would be loaded every time.


BlackIntel admin/founder/coder
Please visit http://www.blackintel.org/
Re: editing scripts.dll [message #235492 is a reply to message #235432] Fri, 22 December 2006 15:41 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
ahh, thanks!

EDIT: i tryed all the diffrent type of communication. but i couldn't find a good enough tutorial on one.

[Updated on: Fri, 22 December 2006 15:43]

Report message to a moderator

Re: editing scripts.dll [message #235498 is a reply to message #235451] Fri, 22 December 2006 16:43 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

gamemodding wrote on Fri, 22 December 2006 20:58

so you know how i can detect when it is loaded to start the game?



danpaul, your knowledge of C++ is pretty bad.
All variables are getting destroyed when the dll is loaded an other
time. you they don't have their old value.


When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: editing scripts.dll [message #235516 is a reply to message #235481] Fri, 22 December 2006 19:45 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
StealthEye wrote on Fri, 22 December 2006 21:42

Check whether bhs.dll is already loaded

if (!GetModuleHandle("bhs.dll"))
{
// First time
}

Obviously do this before bhs.dll is loaded in dllmain, as otherwise it would be loaded every time.



it was a simple answer, although, i have been testing and it works a charm! In Love thanks, i would still be stuck otherwise Angry
Re: editing scripts.dll [message #235558 is a reply to message #235498] Sat, 23 December 2006 06:18 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Cat998 wrote on Fri, 22 December 2006 23:43

danpaul, your knowledge of C++ is pretty bad.
All variables are getting destroyed when the dll is loaded an other
time. you they don't have their old value.



I don't usually work with .dll files, in a normal program static variables are static...


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Sat, 23 December 2006 06:19]

Report message to a moderator

Re: editing scripts.dll [message #235561 is a reply to message #235432] Sat, 23 December 2006 07:05 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
dan, im guessing...im not too sure how this works.

when the dll is reloaded, ALL of the variables are destroyed. but somehow my thread isn't Huh
Re: editing scripts.dll [message #235562 is a reply to message #235432] Sat, 23 December 2006 07:18 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
I am assuming that the thread remains intact because of the fact that it IS a separate thread.

Threads do not rely on each other to remain alive, unlike the parent->child relationship you can have with processes. You need to manually code something to close your thread once the .dll closes (I assume there is a function called when the .dll closes, so you should be able to use that)


http://steamsignature.com/card/1/76561197975867233.png
Re: editing scripts.dll [message #235588 is a reply to message #235432] Sat, 23 December 2006 12:15 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
dllmain.cpp, search for DLL_PROCESS_DETACH, put the code to kill your thread in there
Re: editing scripts.dll [message #237179 is a reply to message #235432] Thu, 04 January 2007 03:35 Go to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
will do. thanks Razz

since this is about scripts.dll i have a question, is scripts 3.1 stable? and what benifits will it have on a FDS?
Previous Topic: Help with Exdeath's boned E3 models
Next Topic: single player crashes with the scripts.dll
Goto Forum:
  


Current Time: Thu Dec 12 02:29:12 MST 2024

Total time taken to generate the page: 0.01084 seconds