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 - Vincent

#561
I'm certainly the last person on this forum who can give advice.

But a single boolean could make the difference..

Code: ags

bool on_ground = true;
#562
Beginners' Technical Questions / Re: X-offset
Tue 30/09/2014 18:27:06
Ciao Crimson Wizard, Grazie Mille !

You Are Kind As Usual. The conversion part and rest it was really substantial aid.

Still Thank You for being available to answer, and I hope you can spend a good day.
#563
Beginners' Technical Questions / X-offset
Tue 30/09/2014 17:55:01
Good Evening To All Agser,

Noob Question, As Usual.

I re-searched the forum about this question, and I found a lot of answers about.
I searched in the manual also and I focused the solution.
But I'm not managing to make it work at all. GetViewportX ()
If mouse move to right or left side 'of the screen' and left click mouse is pushed,
if facing right player can shoot with his gun, and viceversa.
In a Room of 640x480, it's okay.
Now, i changed the room in a 2500x800, and i can't make it to work at all.

Here's the code that i have now :

Code: ags

void on_mouse_click (MouseButton button) 
{
  ///////////////// Right Side /////////////////////
  if (button == eMouseLeft && FacingRight) 
  {
    if (mouse.x > player.x) //640x480 it's okay here
    {
    Fire(true, false); //right
    }
  }
  ///////////////// Left Side /////////////////////
  if (button == eMouseLeft && FacingLeft)
  {
    if (mouse.x < player.x ) //640x480 it's okay here
    {
    Fire(false, true); //left
    }
  }
}


I hope for anyone who knows how to do here.
above all, I hope no one is offended by reading this post..
#564
Thank you very much, Crimson Wizard, for giving me this vital aid.
I'm still a good noob, and this suggestion will make me start to improve better this terrible script...

Still, Thank you again
#565
Good Evening To All AGSer.

I have a terrible script that should be cleaned up quite a bit.
I just wrote an idea of what I would do... and apparently works well...
It's what I would do, but when I run the battle, my pc go in slow motion..
I certainly know because the script is not very readable in itself.
This happens to me quite often when I put a function repeatedly.

Code: ags

int time, firstcounter,  secondcounter, thirdcounter, fourcounter, fivecounter, sixcounter, sevencounter, eightcounter, 
    ninecounter, tencounter;

bool pushed, released;

Enemy Monster[8];

function ShowTargetGUI()
{
  GUIControl *theControl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  gTarget.Visible = true;
  if (theControl == ButtonPush && mouse.IsButtonDown(eMouseLeft) && pushed) //button pushed
  { 
    int i = 0;
    while (i<NumeriCasuali(4, 6)){ time ++; i++;}          
    if (time > 5) { gTarget.BackgroundGraphic = 3; firstcounter = NumeriCasuali(1, 5);  }
    //why if i use 'else if' doesn't work ?!
    if (time > 15) { gTarget.BackgroundGraphic = 4; secondcounter = NumeriCasuali(6, 15); }
    if (time > 30) { gTarget.BackgroundGraphic = 5; thirdcounter = NumeriCasuali(16, 30); }
    if (time > 45) { gTarget.BackgroundGraphic = 6; fourcounter = NumeriCasuali(31, 45); }
    if (time > 60) { gTarget.BackgroundGraphic = 7; fivecounter = NumeriCasuali(46, 55); }
    if (time > 75) { gTarget.BackgroundGraphic = 8; sixcounter = NumeriCasuali(56, 70); }
    if (time > 90) { gTarget.BackgroundGraphic = 9; sevencounter = NumeriCasuali(71, 85); }
    if (time > 100) { gTarget.BackgroundGraphic = 10; eightcounter = NumeriCasuali(86, 90); }
    if (time > 110) { gTarget.BackgroundGraphic = 11; ninecounter = NumeriCasuali(91, 100); }
    if (time > 120) { gTarget.BackgroundGraphic = 12; tencounter = NumeriCasuali(101, 115); }
    
    if (time > 125) // (TIME OUT) IF STILL BUTTON PUSHED
    { 
      //Enemy RECOVER ENERGY
      if (Monster[1].ID[1] == cChar.ID && Monster[1].hp < 499) Monster[1].hp += 30;  
      // here 'else if' is okay
      else if (Monster[2].ID[2] == cChar2.ID && Monster[2].hp < 699) Monster[2].hp += 30; 
      else if (Monster[3].ID[3] == cChar3.ID && Monster[3].hp < 899) Monster[3].hp += 30; 
      else if (Monster[4].ID[4] == cChar4.ID && Monster[4].hp < 1099) Monster[4].hp += 30;
      else if (Monster[5].ID[5] == cChar5.ID && Monster[5].hp < 1299) Monster[5].hp += 30;
      else if (Monster[6].ID[6] == cChar6.ID && Monster[6].hp < 1499) Monster[6].hp += 30;
      else if (Monster[7].ID[7] == cChar7.ID && Monster[7].hp < 2499) Monster[7].hp += 30;

      pushed = false;
      Labelcounter.Text = " Time's up"; //time's up
      Labelhit.Text = "You Failed";
      cJack.Animate(1, 2, eOnce, eNoBlock, eForwards);
      gTarget.BackgroundGraphic = 2; //turn to normal graphic 
      time = 0; 
    } 
      SetTimer(1, 30); 
  }
   else if (released)
   { 
     //LOW HIT
     if (time > 5)  
     { cJack.Animate(1, 2, eOnce, eNoBlock, eForwards); 
       Labelcounter.Text = String.Format("%d %", firstcounter); Labelhit.Text = "Low Hit"; }
     if (time > 15) 
     { Labelcounter.Text = String.Format("%d %", secondcounter); Labelhit.Text = "Low Hit"; }
     if (time > 30) 
     { Labelcounter.Text = String.Format("%d %", thirdcounter); Labelhit.Text = "Low Hit"; }
     
     //MEDIUM HIT
     if (time > 45) 
     { Labelcounter.Text = String.Format("%d %", fourcounter); Labelhit.Text = "Medium Hit"; }
     if (time > 60) 
     { Labelcounter.Text = String.Format("%d %", fivecounter); Labelhit.Text = "Medium Hit"; }
     if (time > 75) 
     { Labelcounter.Text = String.Format("%d %", sixcounter); Labelhit.Text = "Medium Hit"; }
     
     //HIGH HIT
     if (time > 90) 
     { Labelcounter.Text = String.Format("%d %", sevencounter); Labelhit.Text = "High Hit";  }
     if (time > 100)
     { Labelcounter.Text = String.Format("%d %", eightcounter); Labelhit.Text = "High Hit"; }
     //super hit
     if (time > 110)
     { Labelcounter.Text = String.Format("%d %", ninecounter); Labelhit.Text = "Super Hit"; }
     
     //CRITICAL HIT
     if (time > 120)
     { Labelcounter.Text = String.Format("%d %", tencounter); Labelhit.Text = "Critical Hit"; }
     
     //TIME OUT IF BUTTON IS RELEASED
     if (time > 125)
     {
      Labelcounter.Text = "Time Out";
      Labelhit.Text = "You Failed"; 
      gTarget.BackgroundGraphic = 2;
      time = 0;      
     }
     time = 0;
   }
   Labelinfo.Text = String.Format("%d", time); 
}

function Battaglia()
{
  countingDown=true; //check if the 'timer battle' is expired or not 

  if (Monster[1].ID[1] == cChar.ID)
  { 
  if (!mouse.IsButtonDown(eMouseLeft) ) //a pseudo - released performance 
    { 
      if (gTarget.BackgroundGraphic == 3) Monster[1].hp -= firstcounter;  
      else if (gTarget.BackgroundGraphic == 4) Monster[1].hp -= secondcounter;
      else if (gTarget.BackgroundGraphic == 5) Monster[1].hp -= thirdcounter;
      else if (gTarget.BackgroundGraphic == 6) Monster[1].hp -= fourcounter;
      else if (gTarget.BackgroundGraphic == 7) Monster[1].hp -= fivecounter;
      else if (gTarget.BackgroundGraphic == 8) Monster[1].hp -= sixcounter;
      else if (gTarget.BackgroundGraphic == 9) Monster[1].hp -= sevencounter;
      else if (gTarget.BackgroundGraphic == 10) Monster[1].hp -= eightcounter;
      else if (gTarget.BackgroundGraphic == 11) Monster[1].hp -= ninecounter;
      else if (gTarget.BackgroundGraphic == 12) Monster[1].hp -= tencounter;
      else if (ButtonExtra.NormalGraphic == 68) TEMPO -= 5; //else if 'button failed' is visible >>> timer battle go down -5
    }
 }


function room_RepExec()
{
    if (InitBattle ) //boolean go true by click a button, boolean go false by hp enemy <= 0
  { ShowTargetGUI(); Battaglia(); }
}


void on_event (EventType event, int data) 
{
  GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  Button*b;
  if (gc != null) b = gc.AsButton;
  
  if (event == eEventEnterRoomBeforeFadein) 
  { mouse.Visible = false; Labelcounter.Text = ""; Labelhit.Text = ""; b = ButtonPush; }

   ////////////// PUSHED BUTTON /////////////////////////////////////////
  else if (event == eEventGUIMouseDown && b != null )
  {
    //Display("pushed");
    pushed = true; 
    Labelcounter.Text = "";
    ButtonExtra.Visible = false;
    //ButtonExtra.X = 12;
    Labelhit.Text = "";
    released = false;
  }
  ////////////// RELEASED BUTTON //////////////////////////////////////
  else if (event == eEventGUIMouseUp && b != null )
  {
    //Display("REL");
    SetTimer(1, 30); 
    pushed = false; 
    released = true;
    gTarget.BackgroundGraphic = 2;
    }
}



Someone could help me to clean up this terrible script ? ,(
and thanks in advance for your patience, also for reading this message post...

coordial greetings
#566
I cannot find fair words to thank you and for your patience too.

I'm not even a religious man
(i don't know about you)
But God must bless you.
You are a Great Master.

Thank you again
For giving me this help, I appreciated

Cordial greetings :)
#567
Hello Guys, I'm really sorry for bothering you again :(
I would like to generate the similar Function or Int "NumeriCasuali" in Float numbers..

Code: ags

float RandomFloat(float min, float max) 
{ 
  if (min == max) return min; // same value, only one possible result
  if (min > max) return RandomFloat(max, min); // min and max reversed, swap them out
  return (min + Random(FloatToInt(max)-FloatToInt(min))); //type mismatch: cannot convert 'float' to 'int' 
}


How to do that ?
#568
Many thanks monkey_05_06 for giving a helping hand, gracious
#569
Exactly ! I just noticed a huge mistake on my part watching again the room script.
It's relatively funny because I wrote explicitly that my integer firstcounter = 0;

Code: ags

bool pushed, released;
int time, firstcounter;

function room_RepExec()
{   
  if (time > 5) { gTarget.BackgroundGraphic = 3; firstcounter = NumeriCasuali(1, 5); }

  else if (released && time > 120)
   { 
      firstcounter = 0; // Why The Hell... !!?
      Labelcounter.Text = "Time Out";
      Labelhit.Text = "You Failed";
      gTarget.BackgroundGraphic = 2;
      time = 0;
   }
   Labelinfo.Text = String.Format("%d %", time);
   time ++;
}


Thanks Khris for the clarification and suggestion.
Cordial greetings
#570
Ciao Khris, Thank you very much for response.

So; Random(2) + 1 it will never return 0 !
i was wondering to create a function similar to the Random one in AGS, with the difference that never returns to 0.

Code: ags

function NumeriCasuali(int minimo, int massimo) //int min, int max
{ 
  return (minimo + Random(massimo - minimo)); //wrong
}


the function apparently works well, but after some time, it happened that it returns to zero again.
how can I do to avoid this ?
#571
Good evening to all AGSer.
I can feel a slight fright in asking this silly question and I apologize in ahead for this has been asked.
Because it looks so basic notion.

Referring to the (Random Function) into the manual says:
Returns a random number between 0 and MAX.
NOTE: The range returned is inclusive - ie. if you do Random(3); then it can return 0, 1, 2 or 3.

So the question was;
How do i do a random function that never return 0 ?
ie. if i do Random(3); then it can return 1, 2 or 3.

Still deeply sorry for asking this, thanks guys in advance.
#572
Quote
GlobalScript.asc(221): Error (line 221): Nested functions not supported (you may have forgotten a closing brace)

Code: ags

function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
}
#573
Ciao CaptainD, Grazie
#574
I really enjoyed this world cup predictions :)
Thanks to Stupot+ for organizing. It was really exciting !


GERMANY WORLD CHAMPION    :-D


Hurraaaaaaaaaaaaaahhhhhhhhhhhhhh here also are celebrating, God can strike me if i can understand the reason...
Anyway, Congratulations To The Germans :)
#575
12-Jul  Brazil 1 - 0 Netherlands
13-Jul  Germany 1 - 0 Argentina *Wildcard*
#576
Congrats for this releasing Ghost !
The game is very well done ! :)
#577
Eheh, I suppose it would have been difficult for anyone to predict this outcome :-X

Nasty Brazil, today, extremely terrible
#578
1 - 7 ? :X

What a terrible match for Brazil :(
Great Germany
#579
Glad to have been of help

Quote
thanks very much Vicent!

"Vincent" it's okay :)
#580

Brazil 1 vs 0 Germany
Netherlands 1 vs 2 Argentina
SMF spam blocked by CleanTalk