Exactly as me,I used long ago and it worked perfectly !
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 MenuQuote from: Crimson Wizard on Mon 30/05/2022 19:38:37Quote from: Pax Animo on Mon 30/05/2022 17:30:23
Hey there,
Something odd is going on when having two characters SayBackground at the same time.
There seem to be a bug there. There will be a temp build with a fix here in roughly 20-30 minutes:
https://cirrus-ci.com/task/5199731981811712
EDIT: readyQuote from: Baguettator on Mon 30/05/2022 18:28:57
So I debugged it and I found what happenned : in one of the file (the one who made the game crashing), there were some "É" characters. And this made the game crash during the substring function.
Could you please post a file? I'd really prefer to test real case rather than trying to reproduce this by luck.
EDIT: well, i tried to put random É in the file, but nothing happened.Quote from: Baguettator on Mon 30/05/2022 18:28:57
The thing is : why ? The file is in UTF-8, and the game too.
The file format does not have a direct relation to the game. File can be read differently, what matters is how it is read and what you do with the data in script. Whether engine works correctly too.
Quote from: Crimson Wizard on Sun 29/05/2022 12:04:45Code: ags nouvelle=s.Substring(r, rr-r); // Error indicates : String.Substring : invalid length
So it fails at Substring?
I tested your code with random "n" to trigger "if (c==n)" condition, and there was no errors. I guess "n" means a line. Could you tell at which "n" it happens, does it occur at any or particular lines?
I need to narrow the situation down to know which exactly conditions cause this error.
EDIT: actually, I ran this code in a loop, from n = 0 to 500, and met no error... tried in both ASCII and UTF-8 mode.
File *f=File.Open("$SAVEGAMEDIR$/cartesinvasion.txt", eFileRead);
int c=1;
while (!f.EOF)
{
String s=f.ReadRawLineBack();
if (c==n)
{
String t="";
this.nom=LectureStringCustom(s, 1);
t=LectureStringCustom(s, 2);
this.famille=t.AsInt;
t=LectureStringCustom(s, 3);
this.valeur[0]=t.AsInt;
t=LectureStringCustom(s, 4);
this.typezombie[0]=t.AsInt;
t=LectureStringCustom(s, 5);
this.valeur[1]=t.AsInt;
t=LectureStringCustom(s, 6);
this.typezombie[1]=t.AsInt;
t=LectureStringCustom(s, 7);
this.valeur[2]=t.AsInt;
t=LectureStringCustom(s, 8);
this.typezombie[2]=t.AsInt;
t=LectureStringCustom(s, 9);
this.valeur[3]=t.AsInt;
t=LectureStringCustom(s, 10);
this.typezombie[3]=t.AsInt;
t=LectureStringCustom(s, 11);
if (t.AsInt==1) this.egouts=true;
else this.egouts=false;
t=LectureStringCustom(s, 12);
if (t.AsInt==1) this.reactivation=true;
else this.reactivation=false;
t=LectureStringCustom(s, 13);
if (t.AsInt==1) this.litsbleus=true;
else this.litsbleus=false;
t=LectureStringCustom(s, 14);
if (t.AsInt==1) this.litsverts=true;
else this.litsverts=false;
}
c++;
}
f.Close();
String LectureStringCustom(String s, int pos)
{
String e=";";
int r, rr;
String nouvelle;
for (int i=0 ; i<pos ; i++)
{
int p=s.IndexOf(e);
if (i==pos-2) r=p+1;
if (i==pos-1)
{
rr=p;
nouvelle=s.Substring(r, rr-r); // Error indicates : String.Substring : invalid length
}
s=s.ReplaceCharAt(p, 'm');
}
return nouvelle;
}
Quote from: Crimson Wizard on Sat 05/02/2022 22:08:32
You can put multiple variables in a managed struct and pass the instance of that struct as 1 parameter. There may be other solutions, depending on the situation: what the function is for, how do you use it, maybe it can be replaced with just a struct and setting struct members instead? But this is a general scripting topic.
Quote from: Crimson Wizard on Sat 05/02/2022 22:08:32
It's currently possible to script your own label or list box that uses several fonts and colors, with DrawingSurface and DynamicSprite functions.
In theory it's possible to implement some kind of a "rich text" control in the engine too, for example one that draws text using html-like tags, but that's a serious work that requires some good design decision first. We have already planned to wrap 3.6.0 version up, and now working towards finishing priority major features. The other features added were ones that cover problems that are too inconvenient for scripting and simple enough to do quickly in the engine at the same time.
If there's an actual interest in such engine feature, you may post it in the engine suggestions forum section, or our issue tracker on github.
function Cartes::Create(int c)
{
this.PlaceTokenA(
// the PlaceTokenA function has parameters like "int tile, int x, int y, int rotation" etc...
}
//34=width when it's not rotated, 30 is the height when not rotated
int l=FloatToInt(Maths.Cos(Maths.DegreesToRadians(45.0))*IntToFloat(34) + Maths.Sin(Maths.DegreesToRadians(45.0))*IntToFloat(30));
int h=FloatToInt(Maths.Sin(Maths.DegreesToRadians(45.0))*IntToFloat(34) + Maths.Cos(Maths.DegreesToRadians(45.0))*IntToFloat(30));
int x, y; // x is the original x position for the top leftcorner of the token, y is the y position of the top leftcorner
int xporte, yporte; // Also the original coordinates of the token
// The tile width and height are equal to 250
if (nouveau==right) // the tile rotates to right, so 90°
{
xporte=250-y-h;
yporte=x;
}
else if (nouveau==down) // the tile rotates to down, so 180°
{
xporte=250-x-l;
yporte=250-y-h;
}
else if (nouveau==left) // the tile rotates to left, so 270°
{
xporte=y;
yporte=250-x-l;
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.099 seconds with 14 queries.