Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - spook1

#1
I amm sorry, but the game open fine, showing creditz and all in 2.72..

I am puzzled, probably something trivial then...?
#2
Yes, I remember changing all string stuff a long time ago.
I was disappointed to learn that I had to redo all that.
I am happy now that that is not the case.

Still wondering what this error means then. The game worked fine in 2.72

The error reads:
Code: ags

room0.asc(35): Error (line 35): Type mismatch: cannot convert 'const string' to 'string'


for the script: (note the remark "// HERE IS THE ERRORR REPORTED")

Code: ags

string TempString;

function addCreditLine(string Text) {
  SetCredit(currentID,Text,colour,font,centered,xpos,generateoutline);
  currentID = currentID+1;
}

function addSpecialCreditLine(int image) {

currentID = currentID+1;

//SetCreditImage(int ID, int Slot, int center, int xpos, int pixtonext);
SetCreditImage(currentID,image,1,1,1);
}
function addCreditSpace() {
currentID= currentID + 1;
}

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for room: First time player enters screen

SetEmptyLineHeight(20);
addCreditLine("Werknaam SpaceSpy"); // HERE IS THE ERRORR REPORTED

#3
thanks. I turned those off, still same error though. ??
#4
Thanks for your advice.

I did not get any other errors, but I fugured onlyn the first one shows up.
Anyway, it is worth a try, maybe the only problem is in the creditz plugin.

My code now looks like:

Code: ags

string TempString;

function addCreditLine(string Text) {
  SetCredit(currentID,Text,colour,font,centered,xpos,generateoutline);
  currentID = currentID+1;
}

function addSpecialCreditLine(int image) {

currentID = currentID+1;

//SetCreditImage(int ID, int Slot, int center, int xpos, int pixtonext);
SetCreditImage(currentID,image,1,1,1);
}
function addCreditSpace() {
currentID= currentID + 1;
}

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for room: First time player enters screen

SetEmptyLineHeight(20);
TempString ="Werknaam SpaceSpy";
addCreditLine(TempString);
addCreditSpace();
TempString = "Story: Timo, Bram, Bram, martijn en Vera";


and I get the error:

room0.asc(12): Error (line 12): type 'string' is no longer supported; use String instead

When I replace the decalration by String TempString, I get a similar error in line :

Code: ags

  SetCredit(currentID,Text,colour,font,centered,xpos,generateoutline);


But then again, i am afraid I will stumble over much much more errors..
#5
After a long time with other issues I decided to pick up my old game (v2.72).
I downloaded the latest AGS engine and stumble immediately over the first error:

room0.asc(36): Error (line 36): Type mismatch: cannot convert 'const string' to 'string'

it is referring to the following line, calling the agsCreditz.dll

addCreditLine("Werknaam SpaceSpy");

Will this be the first error in a long long que and should I refer back to v2.72, or can these issues be solved easily?
(my game contains 35 rooms already and many many sprites and views.

Thanks in advance for your interest in my issue,

Martijn
#6
Just checked in my boss' time.
It was eRoundnearest I forgot in the FloatToInt.
Now it works allright,

Thanks for thinking along with me last night ;-)
#7
Thanks for all these help during my night sleep.

I see one difference in the debug message I use:

I stated:

Display("A_dx = %d", FloatToInt(A_dx);

instead of

Display("Result: %f", A_dx);

Can it be that FloatToInt rounds off in a special way?

I'll look into it after I come back from work; have to make breakfast for my kids now ;-)

CU
#8
Hi Snarkey,

Yes, when looking in the debugger I can see that I_PistonA is -240, the other values are also shown in the debug Gui. (these are initiated in the init() function, elswhere in the script.)

I have a debug- gui set up to display these values. It show also this annoying -1 instead of 0.00168 :-(

thanks for your interest in my problem. Would know of any more suggestions?
#9
In my gam,e the player can move pistons of a lock by connecting a battery to some coils. I mcalculate the current through the coil, and move piston proportionally to this current.
A snip of the script is given below.
At startingpoint the A_dx  value equals -1. I do not understand that, since

I_PistonA = -240
A_DX = -70
MaxPistonCurrent = 10 000 000  (ten million!!)

So how can A_dx = A_DX * I_PistonA / MaxPistonCurrent equal -1??

That would mean that: -1 = 70*240/10000000 . It should read 0.00168!

can anyone help with a suggestion??


Code: ags

  //first set the max movement for full Piston Current
 
  int A_DX = -70;  // means 70 pixels for full movement outward of the disk at max current
  float Zero = IntToFloat(0); 
  float A_dx = Zero;  // because I need much more parameters to be set to Zero later on
 
  //now calculate the actual movement in x direction:
  
  A_dx = IntToFloat(A_DX) * (IntToFloat(I_PistonA) / IntToFloat(MaxPistonCurrent) );

 // and finally move
  
  object[2].SetPosition(36  + FloatToInt(A_dx), 113 );



#10
I am not sure if I am asking for dynamic array..

In my game I calculate currents between conenction points, using a matrix approach. Now I want to:
Code: ags

#define NUMCONNECTIONS 8

function MAX_WIRES(){
	int i;
	int maxwires_loc=1;
	while (i<NUMCONNECTIONS ){
		maxwires_loc = maxwires_loc + i;
		return  maxwires_loc;
	}
}


//NumCurrent = MAX_WIRES() - NUMCONNECTIONS + 1;

// Declare an array variable of type Connection

Connection 	Connections[MAX_WIRES()];
int                            current[NumCurrent];



This obviously does not work.

Is there a way to decalre arrays, depending on a defined value?
This way I can create a general roomscript, where I only need to change the number of connections to have all currents calculated. This is not really dynamic is it?

I am curious to read about any suggestions,

martijn
#11
The script works fine.
I implemented it with just the rawredraw function. It is great!
As soon as I have the whole room functioning (i.e. speed of ants proportional to current) I'll post the compiled game ;-)

Thanks a lot!
#12
Quote from: Gilbot V7000a on Sun 13/01/2008 14:24:23
As I mentioned in my first post, it's V2.72.

How did you open it?


Hmm, excuse me for being silly.  I still had a v2.72 beta installed. I upgrade to the stable  version, now I see the ants marching. Great!

I am not sure that I understand the remarks on the RawRestoreScreen.
It has been a while. I'll study the script to rewrite the DrawWires function into an marching ants equivalent:

Code: ags

function DrawWires() {   
   int i;   // Erase the wires first   
   RawRestoreScreen();   /
   // Draw the wires   
   i=0;   
   while (i<MAX_WIRES) {      
      if (wire.active) {         
           RawSetColor(wire.xcolor);         
           RawDrawLine(wire.from_x, wire.from_y, wire.to_x, wire.to_y);      
     }     
   i++;   
   }
}


If I understand it allright, this script will bge very hard to convert to AGS 3.0, because of the unsopported Rawdraw functions.
I am right in that remark?
#13
Man! You guys are great.
I am really curious to see the example, but I cannot open it in ags 272.
I downloaded AGS3.0 beta but then I ran into a lot of errors,

Can I ask in what versions the example was created?

regards and a many trhanks for the help!
I'll present the result of whole circuit as soon as I have it working

yours sincerely,

Martijn
#14
Hmm, it might have been meself? I am working (on and off, chaged jobs etc) on my educational game. I 've been around in this forum since a few years ;-)
That's why I referred to the link above...
#15
Line are drawn by the using by clicking the start and end point.
For the complete script see:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=12390.0http://www.adventuregamestudio.co.uk/yabb/index.php?topic=12390.0

Thanks for the quick reply and interest in my question,

Sincerely,

Martijn
#16
In my game the player can create electrical circuits by drawing lines between terminals.
I would like to indicate the current flowing through the wire (drawline) by a dot-pattern that moves along the line.
It is a serious game for learning electricity, thats why I want the current to be "visible" in the lower levels.

Can anyone help me with a suggestion? Or would such a feature be too slow when I draw about 12 lines.

Thanks in advance for thinking along with me,

Martijn
#17
I took a look, but it seems quite scientific. Not specially aiming at solving electrical circuits I think..

About the implementation; a few hints might be helpfull.
I do not see how to transpone the arrays from the algoritm in the matrix...

The next step I must take is to put the found arrays in a matrix format.

I can give an example for a few loops, let's say 123, 124, and 125. This is NOT a complete exmaple, the euqations are not enough to really sole the example values, but to get an idea of the apporach it is sufficient.


eg. The arrays represent current loops created by Conns (each with specific restance properties R; set by the gameplay)

123 => Conn12 -Conn23-Conn31
124 => Conn12 -Conn24-Conn41
125 => Conn12 -Conn25-Conn51

In each Conn a current flows:
eg in Conn12, I12 flows

To solve the currents in the circuits, I must solve a set of equations:

Code: ags



I12*Conn12.R + I23*Conn23.R - I13*Conn31.R = 0
I12*Conn12.R + I24*Conn24.R - I14*Conn41.R = 0
I12*Conn12.R + I25*Conn25.R - I15*Conn51.R = 0

(minus signs are because agreement made is to define all currents flowing from 'low' Conn to a 'high' Conn as positive; since these are flowing the other way around, they get the minus sign)

In matrix notation (I use the soleLinearEquation.dll), I can set this up, with 7 columns for:
I12         I13        I14        I15       I23       I24       I25   
 
(C12.R   -C13.R                            C23                            )(I12) = 0
(C12.R                 -C14.R                          C24.R             )(I13) = 0
(C12.R                            -C15.R                          C25.R  )(I14) = 0
(                           etc etc etc                                          )(I15) = 0
(                           etc etc etc                                          )(I23) = 0
(                           etc etc etc                                          )(I24) = 0
(                           etc etc etc                                          )(I25) = Emf


(example covers only the first three euqations!!)


CreateMatrix(NumCols);

 SetMatrixValue(1, 1, Conn12.R );
 SetMatrixValue(1, 2, -1 * Conn13.R);
 SetMatrixValue(1, 3, 0);
 SetMatrixValue(1, 4, 0 );
 SetMatrixValue(1, 5, Conn23.R);
 SetMatrixValue(1, 6, 0);
 SetMatrixValue(1, 7, 0);

 SetMatrixValue(2, 1, Conn12.R );
 SetMatrixValue(2, 2, 0);
 SetMatrixValue(2, 3, -1 * Conn14.R);
 SetMatrixValue(2, 4, 0 );
 SetMatrixValue(2, 5, 0);
 SetMatrixValue(2, 6, Conn24.R);
 SetMatrixValue(2, 7, 0);
 
 SetMatrixValue(3, 1, Conn12.R );
 SetMatrixValue(3, 2, 0);
 SetMatrixValue(3, 3, 0);
 SetMatrixValue(3, 4, -Conn15.R );
 SetMatrixValue(3, 5, 0);
 SetMatrixValue(3, 6, 0);
 SetMatrixValue(3, 7, Conn25.R);


  SetVectorValue(1, 0);  
  SetVectorValue(2, 0);
  SetVectorValue(3, 0);
    
  Solve();                 //solveLineaiequation Command
				//IN THIS EXAMPLE ARE TOO LITTLE EQUATION TO BE ABLE TO SOLVE THE SET.
				//IT IS ONLY AN EXAMPLE OF THE SYNTAX
  
//save the results in an array
  
  current[0] = GetValue(1);  //I12
  current[1] = GetValue(2);	 //I13
  current[2] = GetValue(3);	 //I14
  current[3] = GetValue(4);  //I15
  current[4] = GetValue(5);  //I23
  current[5] = GetValue(6);	 //I24
  current[6] = GetValue(7);	 //I15



The whole puzzles works as follows.

Player sees a filed of connectors and can draw lines from one connector to the other.
All connections are definded with a high resistance so ConnXY.R = 1000000.

When a line is drawn, the corresponding ConnXY.R is set to 1.

After a line is drawn, the Kirchoff matrix is calculated, and consequences are shown (brighter light, moving magnets etc.)

For the connections of the batteries an internal resistance is defined, and in the matrix calculations the EMF is included (not shown in the example above)
#18
Man, this is great!

Thank you so much!
I'll study the script to learn from it. And I'll incorporate it in the puzzles.
Probably stumbling over some new problems, but I'll keep you informed ;-)

thanks again,

Martijn
#19
Maybe I am way off topic, but I'll try and see if anyone knows a solution, or some suggestions to start with,  for my programming problem.

In my educational game I create many puzzles with electrical circuits. Now I am up to something more generic and new. Off course to share with the community, once it works :D

The latest puzzles I designed allow the player to connect any two contacts out of a total of "IntMaxContacts" contacts. Goal is to adjust the current between some of the contacts in such a way that an electric lock can be opened.

Now I have to set up Kirchoffs equations for all possible connections between two points.

My question:

I am looking for an algoritm to list all the possible closed circuits (triangles, squares, pentagons etc) in my field of a number of "IntMaxContacts" contacts.

Example:

If I have 6 contact points, numbered 1 to 6, I can make the following circuits:

123                         1234                    12345   123456
124 234                  1235 2345           12346
125 235 345           1236 2346 3456
126 236 356 456                                12356
                               1245
134                         1246 2356           12456
135 245                                              13456
136 246 356           1256                   
                                                           23456
145                         1345
146 256                  1346 2456

156                         1456

These loops represent all the possible single circuits to be made in my 6 point contact field.

I am looking for a way to create this list dynamically, for a given set of contactpoints.
I am sure that the code can be very elegant (maybe with nested function?), but cannot see it; being a simple physics teacher rather than a programmer :-()


Does anyone have any suggestions how to program that?
I am not familiar with the arrays and dynamic looping...


From this I must create the matrix for the kirchoff equations. The equations will be somewhat like
Example:

for the 123 circuit:       I12*R12 +I23*R23 + I31*R31 = 0;
for the 2356 circuit:     I23*R23 + I35*R35 + I56*R56 - I62*R62 = 0;

Convention: current's positive way: from low contact to high contact.

so the equations become:

for the 123 circuit:       I12*R12 +I23*R23 - I13*R31 = 0;
for the 2356 circuit:     I23*R23 + I35*R35 + I56*R56 - I26*R62 = 0;

I will define all the R values (some may be changed by the player, creating new contacts) and calculate the currents using a Gauss Jordan algoritm in a dll.

Can anyone help me with some suggestiosn to start with?

Regards,

Martijn




#20
Thanx a lot for the references.
And yes, actually I am building a game engine.
It will be used to create small adventure games.

SMF spam blocked by CleanTalk