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

#61
Thanks a lot!!
In university I took a course in pascal programming. But I never got to the pointers- it was for the advanced curse ;-)
So now my time has come.

This code was also published in the technical archive, so once I worked it out, I'll publish it also there,

Regards,

Martijn
#62
You can call a function from a dialog by e.g.
run-script(1)

This will call script number 1.
In my example script-1 will make the player character walk to 282,185.
script number 2 will end the game.

You can add a many scripts as you like.


To implement this you must add a function in the Global script:

Code: ags

function dialog_request (int parameter) {

  if (parameter == 1) {
    cEGO.Walk(282, 185);
}

  if (parameter == 2){
		Display("GAME OVER!");
		QuitGame(0);
  }
  
} 
#63
I use the following code:
Code: ags

#sectionstart room_cÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function room_c() {
Ã,  // script for room: Player enters screen (before fadein)

 gHeartbeat.Visible = false;


Yet the GUI gHeartbeat stays visible when I open the game with this room.
When I start in another room and transfer the character by the debug code to this room, the GUI is not visible...
How can I get rid of it?

Any suggestions?
#64
I use the script for typewriter style credits (one letter at a time).

The function I use for this is :
Code: ags


function TypeLine(string line, int vspacing){
Ã,  
Ã,  int length=0;
Ã,  int i = 0;
Ã,  string displayedline;

Ã,  int textid = 0;

Ã,  length = 0;Ã,  
Ã,  i=0; 
Ã,  StrCopy(displayedline," ");
Ã,  
Ã,  textid = CreateTextOverlay(xpos,50,400,font,colour,displayedline);

Ã,  length=StrLen(line); //set string length
Ã,  while(i<length){
Ã,  Ã,  
Ã,  Ã,  StrFormat(displayedline, "%s%c", displayedline, StrGetCharAt(line,i));
Ã,  Ã,  SetTextOverlay(textid, 10,vspacing,400, font, colour, displayedline);

Ã,  Ã,  if (StrGetCharAt(line,i) == ' '){
Ã,  Ã,  Ã,  Wait(10);
Ã,  Ã,  }
Ã,  Ã,  else{
Ã,  Ã,  Ã,  PlaySound(1);
Ã,  Ã,  Ã,  Wait(5);
Ã,  Ã,  }
Ã,  Ã,  i++; 
Ã,  }
Ã,  return textid;
}



I seem to have to replace the CreateTextOverlay function by
static Overlay* Overlay.CreateTextual(int x, int y, int width,
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  int font, int color, string text)

according to the help files.

I do not know what to do with this code snip ??
What does a star mean? How do I declare, define, adjust my function??

Any help would be greatly appreciated since I have stumbled over this before.
I was quite fluent in the old script, but now I get confused over and over again....
But I'll learn how to overcomeÃ,  :-P
#65
thanks for helping. The solution works great. Off course, how would the program know what Gui to adjust...

I got confused by the example in the help, stopped thinking and lack exprience in OO programming ;-(

#66
     SetBackgroundFrame(2);
     GUI.BackgroundGraphic = 108;

regards,

Martijn
#67
I cannot change the background image of my GUI.

Help says:

BackgroundGraphic property
(Formerly known as SetGUIBackgroundPic, which is now obsolete)

int GUI.BackgroundGraphic

Gets/sets the background image of the GUI.
You can set this to 0 to remove the background image from the GUI.

But neither the obsolete or the actual command succeed...

Any suggestions?
#68
Ok, I almost get it. Thanks for your ongoing interest in my little troubles ;-)

What i do not get yet: are the  runscripts not connected to "once in a room" events like: first time enter room, enter room before fade in, enter room after fade in, leave room, repeatedly execute etc.

Can I make a special Runscript that occurs more than one time?

My events should happen after I talked to a character (so they are based on a poll of a Global Integer (see my other question today :-))
How can I split that up in four different events??

regards Martijn
#69
Thanks a lot!
I'll use the GI polling technique. It seems the easiest for me in my little game here.
The more elaborate answer provides me with new insights! Thnaks for that as well.
#70
Thanbks for helping out. There is one thing I do not understand yet though.

I thought that i did have different runscript interactions by calling cEgo.Say("..."); each time again. In btween two of these commands the function could make the room change, couldn't it?
Well, obviously not, but I fail to get the logic I'm afraid.

Thanks for thinking along with me,

martijn
#71
I can define an event to happen when I talk to a character in the character definition window.
Now I need to have a local event (adressing room-variables) and therefore I need an event in a room, on "talk to character".

Is there a standard way to do this?

regards,
Martijn
#72
I feel rather silly, asking another easy question. But I cannot find the answer anywhere.

It has something to do with code running in the background??

I have a set of cEgo.Say("   "); commands.
(I must work this way, rather than use the dialog because I use %d variables in my speech)

At a certain point a function is called, and under conditions a transition must be made to another room.
The change is not made though, but the cEgo.Say("   "); speech commands continue to go on.

The funtion is something like :
Code: ags

function CheckSettings(int StartHB, int fluctuatie, int alarmgewenst){ 	
if ((StartHB + fluctuatie > GetTopLimit(StartHB))  || (StartHB + fluctuatie < GetBottomLimit(StartHB))  ){  
                Display("Alert");
	PlayAmbientSound(1, 1, 255,0,0);
	
	Display("Operatie mislukt, contract overleden...");
	StopAmbientSound(1);				cEgo.ChangeRoom(7); 
}

The change is never made though in the script below. Worse: the final changeroom generates an error: "already changeroom due"

here is the complete  script
Code: ags

if (GetGlobalInt(1)==1){
  cNurse.Say("Nou is het afwachten .... of ie het doet!");
  cNurse.Say("Onze kwaliteitsnorm eist 3 correcte alrams op rij.");
  cNurse.Say("Als u dat haalt blijven wij uw klant");
  cNurse.Say("Blijft u maar even rustig afwachten. u hoeft niets te doen");
  CheckSettings(80, 22, 1);   
			
  CheckSettings(70, -12, 0);  
  cNurse.Say("Laat eens even checken wat de waarden nu zijn meneer");
      
  CheckSettings(110, 12, 1);   
  cNurse.Say("En dat was drie. Ik ga naar bed en u kunt naar huis.");
  cNurse.Say("Onze dank is groot!!");
  cEgo.ChangeRoom(7);
	 }  


any suggestions would be very welcome      }
#73
Is there anything I can do about this error?

I copied the creditz script from on alder game into a new game.
Now I get an error on:

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

about the string conversion

any suggestions?
#74
 :-[
Gui was set as not clickable.
:-[
Very stupid indeed. Sorry to have bothered you.
That is why I could not find the answer in the forums. The question was too stupid ;-)

Thanks for helping, suggesting these extreme simple things is really clever.
Regards,

Martijn
#75
Wow, thats fast! Thanks!

I have tried the displays, but it seems that the buttons is not pressed.

In the Gui editor I have set for the button:

left click : run script
Click:        High_up_Click

I have only one room at the moment.

I am afraid it is something stupid.

I have the HV value declared in the global script (since I process them there by the button-click events)
From the global script I export it to the room script.

I try to clikc with a mouse.Mode = 6 (pointer). Also the mdes for walking, looking do not work ...

other suggestions??



#76
I created my own GUI and want to see a lable change value as I click a button.
When I click the button nothing happens though.

I am obviously missing something trivial, but what???

I have aÃ,  GUI with button: High_up


#sectionstart High_up_ClickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function High_up_Click(GUIControl *control, MouseButton button) {
Ã,  if (HV < 296) { HV = HV + 5;}
}
#sectionend High_up_ClickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

The int HV is exported to my room.
In the repeatedly execute of the room I call:

function room_b() {
Ã,  // script for Room: Repeatedly execute
Ã,  Ã, 
Ã,  String buf = String.Format("%d", HV);
Ã,  High_value.Text = buf;
Ã, 
}
#sectionend room_bÃ,  // DO NOT EDIT OR REMOVE THIS LINE
#77
Great! Thanks a lot!!
#78
Is there a paramter to set the background animation speed from the script?

regards,

Martijn
#79
Is there a way to make specific regions of a character clickable?
E.g. make character touch his hair, feet, etc.
Look at different parts of the body.
To be more specific, I need this for interaction with a vehicle which is defined as a character.
I create some function Check_clicked_spot(), but now I started wondering if such a thing is already by default available in AGS.

regards,

Martijn
#80
I did not import the module in the maingame (my maingame is named SpaceSpy). I run the minigame as standalone for the time being. Implementing in the main game is planned later, when the minigame is finished so to say.

Won't the module work as standalone anymore?

I am sorry to confess that I do not understand the module completely :-(

regards,

Martijn
SMF spam blocked by CleanTalk