Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Custom c++ Scripting question
Custom c++ Scripting question [message #75963] Sun, 04 April 2004 15:28 Go to next message
TheKGBspy is currently offline  TheKGBspy
Messages: 96
Registered: April 2003
Karma: 0
Recruit
lately i worked on my scripts for vengeance. they work.. but i have some problem if i do some stuff.

			preset = "none";

			while (preset == "none")
			{
				rand = Commands->Get_Random_Int(1,4);
				switch(rand)
				{
					case 1:         preset = Get_Parameter("Tree1_Preset");
									break;
					case 2:         preset = Get_Parameter("Tree2_Preset");
									break;
					case 3:         preset = Get_Parameter("Tree3_Preset");
									break;
					case 4:         preset = Get_Parameter("Tree4_Preset");
									break;
				}
			}


this is a part of my code. if i remove this part of the code and i set up the preset value by Get_Parameter("Tree1_Preset"); (or tree2 or ....) it work, but if i put my while and switch command the game freze... is that because the while and the switch freeze up the game? i remember in delphi the while stop the whole program.. until the while is finished.. i want to know if this is the same problem... and how to fix it.


Ra2: Vengeance Project lead(it's Dead... sorry)
An empty Ghost since 2005.
Custom c++ Scripting question [message #75967] Sun, 04 April 2004 15:51 Go to previous messageGo to next message
vloktboky is currently offline  vloktboky
Messages: 290
Registered: February 2003
Location: Kentucky, USA
Karma: 0
Recruit

Put a Sleep() at the end of your while loop.
Custom c++ Scripting question [message #75972] Sun, 04 April 2004 16:07 Go to previous messageGo to next message
TheKGBspy is currently offline  TheKGBspy
Messages: 96
Registered: April 2003
Karma: 0
Recruit
onyl sleep command? no attribute seeting a number of ms?

Ra2: Vengeance Project lead(it's Dead... sorry)
An empty Ghost since 2005.
Custom c++ Scripting question [message #76103] Mon, 05 April 2004 11:17 Go to previous messageGo to next message
gibberish
Messages: 366
Registered: May 2003
Karma: 0
Commander
Im not sure what you are trying to do with the while.
I suggest removing the while completely.
Custom c++ Scripting question [message #76158] Mon, 05 April 2004 14:16 Go to previous messageGo to next message
TheKGBspy is currently offline  TheKGBspy
Messages: 96
Registered: April 2003
Karma: 0
Recruit
nah this was only a bad way to compare 2 string that i use. while (preset == "none") is a bad format. Jonwil told me that we need to use stringcmpr command wich work perfectly. my script work with my switch and my while without any problem Smile


btw is there someone who know the c++ command for the round? Round or round dont seem to work.


Ra2: Vengeance Project lead(it's Dead... sorry)
An empty Ghost since 2005.
Custom c++ Scripting question [message #76164] Mon, 05 April 2004 14:28 Go to previous messageGo to next message
vloktboky is currently offline  vloktboky
Messages: 290
Registered: February 2003
Location: Kentucky, USA
Karma: 0
Recruit

You mean round a float value?

float x = 3.152;
int y = (int)x;
printf("y = %d\n",y);

Output: y = 3

Custom c++ Scripting question [message #76283] Mon, 05 April 2004 19:26 Go to previous message
TheKGBspy is currently offline  TheKGBspy
Messages: 96
Registered: April 2003
Karma: 0
Recruit
sweet thank! Very Happy

Ra2: Vengeance Project lead(it's Dead... sorry)
An empty Ghost since 2005.
Previous Topic: C&C_Ghetto
Next Topic: scripts.dll 1.5.1/1.6
Goto Forum:
  


Current Time: Mon Dec 02 15:45:15 MST 2024

Total time taken to generate the page: 0.00686 seconds