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

#201
Thanks i'll give it a try ;)
#202
hi guys i have a big problem with this marvellous module. I want to reset scrollstate not only when the dialogue stop but each time after a return in the dialogue. I have it works like this:

Code: ags

@15
Bibl:Lo si incontra spesso in giro mentre vaga senza meta leggendo un libro...
Bibl:... con un' espressione da suicidio...
  CDG.scroll_from =0;
return


but i have to put it in every dialogue option of the game, i didn't find any way to create an if statement in the global script to check if dialogues are stopping or return. Can someone help me?
#203
Hello guys i wanna do something like MI1 governor's house selecting actions and objects automatically  and even moving the cursor around. Is it possible?
#204
added a little background screenshot :)
#205
hello guys, i want to make a slider to change the screen brightness but with System.gamma doesn't work in windowed mode and most of all doesn't work on Windows 8.1.
Any solution?
thanks :)
#206
i have a little problem using inventory item with "use with". The centre of the cursor moves diagonally upleft and it's difficult to higlight small objects. Is there a way to avoid this?

Solved:I didn't know i have to set a mouse cursor for every inventory Item, now works fine.
#207
thanks guys, sorry for plugin instead of module :)
the solution with array was brilliant and gave me the chance to work with them in ags and also optimize some old code in the game. ;)
#208
Quote from: monkey_05_06 on Mon 29/12/2014 09:03:30
There are three major problems I see with your code.

Problem 1: You believe that whitespace in code is evil. While it can be overdone, unless your mission statement is to have no one ever see, read, use, or understand your code, then whitespace is a must. As a general rule of thumb, if you're putting more than one command on a single line, you're probably doing it wrong.

Code: ags
int dialoghi = 0;

function room_RepExec()
{
  if (BISTICCIO)
  {
    if (dialoghi == 0)
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (IsTimerExpired(2))
    {
      cbibl.UnlockView();
      SetTimer(1, 20);
    }
    if (dialoghi == 1 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 2 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 3 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 4 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 5 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 6 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 7 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 8 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 9 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 10 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 11 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 12 && IsTimerExpired(1))
    {
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;
    }
    if (dialoghi == 13 && IsTimerExpired(1))
    {
      dialoghi = 0;
    }
  }
}


Problem 2: You're breaking one of the first rules of programming: DO NOT repeat yourself. You have the following six lines of code repeated thirteen times:

Code: ags
      cbibl.LockView(43);
      cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
      cbibl.SayBackground("asdas");
      SetTimer(1, 80);
      SetTimer(2, 60);
      dialoghi++;


There is no excuse for copypasta like this showing up in your code. If necessary, create a separate function. In your case, however, it's a matter of...

Problem 3: Abusing conditional statements.

If you are checking the same condition (e.g., IsTimerExpired(1)) several times when you have no logical reason to believe that the result may have changed in-between, then you are doing it wrong. If you find yourself checking multiple values of a variable as separate conditions with the same end-result, then you are doing it wrong. If you are checking that a variable value falls within a certain range by using multiple equals checks, then you are doing it wrong.

Here is a more realistic example of what your above code should look like:

Code: ags
int dialoghi = 0;

function room_RepExec()
{
  if (BISTICCIO)
  {
    if ((dialoghi == 0) || (IsTimerExpired(1))) // this is SLIGHTLY redundant (if dialoghi is 0), but it saves us duplicating other code
    {
      if ((dialoghi >= 0) && (dialoghi < 13)) // 0 <= dialoghi < 13
      {
        // note these lines aren't duplicated 13 times!
        cbibl.LockView(43);
        cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);
        cbibl.SayBackground("asdas");
        SetTimer(1, 80);
        SetTimer(2, 60);
        dialoghi++;
      }
      else if (dialoghi == 13) // ONLY if the previous condition was FALSE, then check this one
      {
        dialoghi = 0;
      }
    } // has timer 1 expired
    if (IsTimerExpired(2)) // no ELSE, we want to check timer 2 whether timer 1 has gone off or not
    {
      cbibl.UnlockView();
      SetTimer(1, 20);
    }
  }
}





I realize you are probably fairly new to programming, so please don't take this the wrong way. However, if you look at the expanded version of your code (Problem 1) and compare it to the final version (Problem 3), you'll see that I've cut over 77% of the lines while still maintaining readable code. The benefits of basic programming concepts like these speak for themselves.

As to your actual solution, there isn't really anything that could be done much more eloquently in terms of getting the speech animation to play for background speech aside from making the code more generic*. I've authored a few modules (QueuedSpeech, PersistentSpeech) that manually control the speech animation in-sync with non-standard character speech (e.g., not a blocking Say command). If you're interested, you could look at those modules, or else myself (and others) would be able to show you how to pull that particular feature and use it in your game, but I first feel that it is more important that you understand these more basic programming concepts. Once you have a strong grasp on the basics, then branching out into more advanced topics will be within your reach.

*And for what it's worth, generic programming isn't always simpler, cleaner, or more eloquent than a specialized solution. Instead, I mean that generic code would be more versatile, easily applied to other characters in other situations, adapt to variable game speed, text reading speed, and the like.

Edit: Looking back over this, I realized that the dialoghi == 0 condition actually doesn't depend on the timer, which is what sets everything else in motion. I amended my modified code to reflect this. Again, there are other ways you could accomplish that result, but this is effective enough to show what I am talking about.

thanks so much for advices, you're right i'm a noob to programming, this is why for me it's hard to optimize the code and write it in the properly way (but i'm learning thanks to all of you, six month ago i didn't know anything about coding). There's something i don't understand, maybe because i used copy and paste to show it. The text should change with counter, "asdas" was only an example (it was in the actual code) to try the scene. Can you help me to do this better than my horrible code :) (i know it's horrible this is why i opened the topic even if it works)
i will take a look at plugins but before use them i need to understand the concept.
#209
Quote from: Monsieur OUXX on Sun 28/12/2014 22:44:52
I don't know exactly what's wrong with your code, but the "queued background speech" module (s) should make your life much easier.

This one : QueuedSpeech v3.5 here
Or that one : BgSpeech v2.2 here
thanks i will take a look ;)
#210
I've tried this code without lockview and animate and the classic speech view doesn't work so i solved like this:

Code: ags

     int dialoghi=0;
function room_RepExec()
{
    if (BISTICCIO==true){
    if (dialoghi==0){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (IsTimerExpired(2)){cbibl.UnlockView();SetTimer(1, 20);}
    if (dialoghi==1&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==2&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==3&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==4&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==5&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==6&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==7&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==8&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==9&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==10&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==11&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==12&&IsTimerExpired(1)){cbibl.LockView(43);cbibl.Animate(0, 6, eRepeat, eNoBlock, eForwards);cbibl.SayBackground("asdas");SetTimer(1,80);SetTimer(2, 60);dialoghi++;}
    if (dialoghi==13&&IsTimerExpired(1)){dialoghi=0;}
    
  }
  
}

is there a lighter way to do this?
#211
Quote from: Cassiebsg on Thu 18/12/2014 22:48:33
You can add the code at the start like this:

Code: ags

    // Dialog script file
    @S  // Dialog startup entry point
      cUomobar.LockView(33);
      cDonnabar.LockView(53);
    return
    @1
    Uomobar:sdfsdfs sdgfsdfsdf sdf sdfgsdfgsdfgs sdgf sdgsdgsdfgs
    return
    @2 // exit option
    Uomobar: Goodbye...
      cUomobar.UnlockView();
      cDonnabar.UnlockView();
    stop


You can also do this:

Code: ags

function cUomobar_Interact()
{
      cUomobar.LockView(33);
      cDonnabar.LockView(53);
      dUomobar.Start();
}


And unlock the view inside the dialog... or you can check if the exit option (2) of the dialog has been chosen and if so, then unlock the view.
I would put the code inside the dialog. But maybe someone else has a better suggestion for you. 8-)

thanks :)
#212
Quote from: Cassiebsg on Thu 18/12/2014 22:08:20
May I ask what you are trying to do?

If dialog is running and you want something to happen, then your best bet is the just add the commands inside the dialog, if you want some BG stuff going at the same time it's a bit more complex (I don't know exactly how, but do a forum search. It has been answered not too long along... this week I believe).

As for when the dialog is stopped, I normally check for a particular dialog option and to see if it has been selected, but there's about (at least) 3 different ways to check for dialog ending.

i would avoid to repeat for any option the same code in the dialogue
like
Code: ags

// Dialog script file
@S  // Dialog startup entry point
return
@1
  cUomobar.LockView(33);
  cDonnabar.LockView(53);
Uomobar:sdfsdfs sdgfsdfsdf sdf sdfgsdfgsdfgs sdgf sdgsdgsdfgs
  cUomobar.UnlockView();
  cDonnabar.UnlockView();
stop


i'm wondering if there is a command  that lock views on start dialogue and release  them when the dialogue stops working on global dialogue and not within the single options.
#213
Hi guys, is there a way to check if the dialogue is running?
like
Code: ags
if (dPlayer is running) {
                do some stuff}
 or          if (dPlayer is stopped){
                do other stuff}

thank you for the answers.
#215
Quote from: abstauber on Tue 09/12/2014 09:20:41
sorry, it seems like I misunderstood what you wanted.
I don't think it's possible to change the frame, once AGS automatically changes the view. But I'm not 100% sure.

A way I can think of is to use two characters as one. One "character" is the body and the other "character" only shows the head and follows the body-character exactly.
i'll give it a try, thanks
#216
Quote from: abstauber on Mon 08/12/2014 14:55:40
But you have to admit that now all topics are being shown ;)

This module can provide scrolling dialogs, but it takes some time to get used to it.
http://www.adventuregamestudio.co.uk/forums/index.php?topic=36313.0

I'm also using a scumm style scrolling dialog GUI in AeroNuts, which has been open-sourced.
the module works fine thanks, for aeronuts where i can find the sourcecode?
#217
Quote from: abstauber on Sun 07/12/2014 08:42:50
Yes there's is way but it involves somewhat advanced custom dialog scripting.

For starters you can do remove the current GUI to get AGS' default behavior.
In "General Settings" under "Dialog" set "Use GUI for dialog options" to 0. That way the dialog box scales up to show all the topics.

with zero i have this result

#218
Quote from: abstauber on Sun 07/12/2014 08:50:17
Have you tried this?

Code: ags

player.ChangeView(THEVIEW);
player.loop = 2;
player.frame = 4;


But I'm not sure if the loop is reset to 0 if you change the view. So if that happens, you need to save the frame first:
Code: ags

int temp_frame = player.frame;
player.ChangeView(THEVIEW);
player.frame = temp_frame;


i don't understand entirely the answer :( where i have to put this code? i've tried in room_RepExec() like this
Code: ags
int temp;
function room_RepExec()
{temp=cMelvin.Frame;
  if (cMelvin.SpeechView==50){cMelvin.Frame=temp;}//50 is the thespeechview
  
}

but doesn't work :(
#219
Quote from: abstauber on Sun 07/12/2014 22:02:03
For this you need to activate "Run game loops while dialog options are displayed". You'll find it in General Settings.

Then you need to add the function repeatedly_execute_always() manually to the script and add those cloud moving lines there

Code: ags

function repeatedly_execute_always() 
{
    if (IsTimerExpired(4)) {
        ocloud.X=ocloud.X - 1;
        SetTimer(4, 20);
    }

    if (IsTimerExpired(5)) {
        ocloud1.X=ocloud1.X - 1;
        SetTimer(5, 20);
    }
}


Great :) i didn't know it can be added to room script i read about it but i thought it was obsolete.
works fine
#220
hi, i want to move clouds in background even when the dialogue is running, i did like this

Code: ags
function room_RepExec()
{ 

if (IsTimerExpired(4)){ocloud.X=ocloud.X - 1;SetTimer(4, 20);}
if (IsTimerExpired(5)){ocloud1.X=ocloud1.X - 1;SetTimer(5, 20);}
}


but doesn't work during dialogue, the clouds stop moving :( i tried also with object.move but the speed is too much fast
any suggestion?
SMF spam blocked by CleanTalk