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

#1
I'm sorry to largopredator who PM'd me with a problem, I've been suffering from an illness and have only just logged in.

The problem is as following:
Quote
Hi Lazarus,

Just thought I'd let you know your FadingThingsNonBlocking module isn't working too well with AGS 3.1.

I used it with 3.02 and it worked perfectly, but when I upgraded, instead of fading objects in, it shows the objects right away, just really bright. Then it comes down to regular brightness, and vice versa when it fades back out. I don't know what's going on with that.

I'm not familiar with the lastest versions, so if anyone can have a look at it I would be grateful thanks.
#2
Module is updated to 2.29 to allow for 300 characters per room, I lowered the characters to 100 to try and stop the pausing effect when using cutscene function and to speed up the module, but as it happens with the way the update was rewritten Max values can be anything without effecting the cutscene function, as it checks if fading is needed or not.

Originally I was going to have both combined into the one module, but as I was having some problems with this one I decided it was easier to keep them seperate. They do work next to each other with no conflicts.

With the speed setup I was trying to keep it sort of constant with other settings in ags where negative values speed up animations for example.

With regards with your module and knowledge you are way more advanced than I'am.

With this module it was what I needed within my game and thought maybe other people would like, you are more than welcome to release yours if you wanted I wouldn't take to hard  :P

I have noticed in some games that I've played where a character or object is faded out that they forgot to remove them from the room, so I thought why not do it automatically for them.

As I said earlier your knowledge is way more advanced than mine, I'm still learning everything and no offence is taken, so any new ideas is always welcome.
#3
Thanks again to Ashen for the help.

Module has been updated so there should't be a pause while using cutscenes.

Value of objects,characters and gui's have been lowered to speed up the module to 50 different Objects, 100 different Characters and 50 different Gui's as this is per room settings and should be enough for most people.
#4
Thanks to Scorpiorus for spotting my error and the module has now been updated.

Also it's nice to see people using the module, good luck with your project
#5
Thanks Scorpiorus I've updated module
#6
If it's just the once then add the script to first time player enters screen or where ever the trigger could be to start the speech:
Code: ags

if ((cTom.Room == 10) && (cJohn.Room == 10)) { 
// This is to check that both characters are in the same room (10).
// If either characters are not in the room the speech is stopped.

Ã,  QueuedSpeech.Say(cTom, "Hi John nice to see you");
Ã,  QueuedSpeech.AddDelay(80); 
Ã,  QueuedSpeech.Say(cJohn, "Hi Tom I'm fine thanks");
Ã,  QueuedSpeech.Say(cTom, "Did you hear about Roger?");
Ã,  QueuedSpeech.AddDelay(80);Ã,  
Ã,  QueuedSpeech.Say(cJohn, "Roger ...");
Ã,  QueuedSpeech.Say(cJohn, "is he the badly drawn character from Roger Wilco?");

}
else QueuedSpeech.ClearQueue();


#8
This is what I use, under the room settings open up the room interactions editor and under "repeatedly execute"
create a new action and select "run script".

In this you can then add the following:
Code: ags

if ((cTom.Room == 10) && (cJohn.Room == 10)) { 
// This is to check that both characters are in the same room (10).
// If either characters are not in the room the speech is stopped.

Ã,  if ((QueuedSpeech.GetID(cTom, "Hi John nice to see you") == 0) && (!QueuedSpeech.IsTalking())) {
// This needs to have the first line of speech copied here.

Ã,  Wait(1);
Ã,  QueuedSpeech.ClearQueue();
Ã,  }

Ã,  QueuedSpeech.Say(cTom, "Hi John nice to see you");
Ã,  QueuedSpeech.AddDelay(80);Ã, // adds a pause in this case of 80
Ã,  QueuedSpeech.Say(cJohn, "Hi Tom I'm fine thanks");
Ã,  QueuedSpeech.Say(cTom, "Did you hear about Roger?");
Ã,  QueuedSpeech.AddDelay(80);Ã,  
Ã,  QueuedSpeech.Say(cJohn, "Roger ...");
Ã,  QueuedSpeech.Say(cJohn, "is he the badly drawn character from Roger Wilco?");

 }
else QueuedSpeech.ClearQueue();


Hope this example helps you.
#9
With regards to the "MainInventory" error you will need to give the inventory box on the maingui (gui 1, control 11)a script name called MainInventory.

Also I'm using the module QueuedSpeech version 2.1 by monkey_05_06. Which works with ags 2.70 + for background speech
#10
Firstly a big thank you to Ashen with helping me with this module.

Fading Objects, Characters & Gui's Non Blocking.

FadingThingsNonBlocking.zip Current version 2.29

Requirements:-  AGS 2.70 +

This Module is for fading objects, characters & Gui's Non Blocking function, in that you don't have to wait for these functions to finish before something else happens.
So you can fade in or out an object while messages are spoken for example.
-----------------------------------------------------------------------
This module allows for upto and including 50 different Objects, 300 different Characters and 50 different Gui's to be faded in/out simultaneously or staggered with the timer control. (Per Room)

This is reset PER ROOM.

At the moment the current ags limits are:
20  objects per room
300  characters
50  GUIs
-----------------------------------------------------------------------

This module uses the script O-names for all the commands.
-----------------------------------------------------------------------

Command examples:-
Code: ags

FadeObjectIn_NoBlock(oWax, 0, 0);
FadeObjectIn_NoBlock(oWax, 0, 0, 250);
FadeObjectOut_NoBlock(oWax, 100, 0);

FadeCharacterIn_Noblock (cEgo, 0, 0); 
FadeCharacterIn_Noblock (cEgo, 0, 0, 0, 100, 150); 
FadeCharacterOut_Noblock (cEgo, 100, 0);

FadeGuiOut_NoBlock(gMaingui, 100, 0);
FadeGuiIn_NoBlock(gMaingui, 0, 0, 250);

-----------------------------------------------------------------------
Objects & Gui's with a transparency of 100 will be turned off automatically
NPC Characters with a transparency of 100 will be moved to Room (-1). But NOT the player Character.
-----------------------------------------------------------------------

VALUE = Transparency: -
Fade Objects, Characters & Gui's In/Out by value which can be any value between 0 and 100.
0 = visible
Any number between = ghosting
100 = invisible
-----------------------------------------------------------------------

SPEED: -
Setting the speed of fading.
-20 = Even Faster etc..
 -1 = Fast etc..
  0 = normal
  1 = slow
  2 = slower
  3 = even slower etc..
-----------------------------------------------------------------------

TIMER:-
Timer is like a fuse on a bomb in that say you entered the figure 250, this will count down to 0 (zero) and then execute the command.
Entering the number 0 (zero) will execute straight away. (You cannot enter minus figures).

Also if you don't need the timer but want to use the new coordinates then just enter 0 (zero) for the timer.
-----------------------------------------------------------------------

OBJECTS: -
Objects now don't need to be ticked visible and have transparency set to 100 before use.
Instead you can leave the objects unticked so they are turned off, and then just use the FadeObjectIn function
as turning an object on is dealt within the function.

The FadeObjectOut function now turns objects OFF automatically if transparency = 100.

Commands:-
FadeObjectIn_NoBlock(oWax, 0, 0, 250);
Will fade the object Wax in, totally visble,speed normal with a 250 timer delay.
-----------------------------------------------------------------------

CHARACTERS: -
If characters are already starting in room 5 for example you will have to set that characters transparency
in that room, using a run-script under (Before Fadein) e.g.

character[EGO].Transparency =100; // Invisible
or
cEgo.Transparency = 100; // Invisible

Or you can have that character to start in room (-1) or from another room and just use the FadeCharacterIn function
and all transparencies are dealt with e.g.

Commands:-
FadeCharacterIn_Noblock (cEgo, 0, 0);
This will fadein character EGO totally visible using normal speed.

Also you can set where if needed new X and Y positions of a character when fading in,
this is an optional command, so you don't need to set these if you want to use the previous coordinates.
e.g.

FadeCharacterIn_Noblock (cEgo, 0, 0, 0, 100, 150);

If you want to use the new coordinates, BUT not the Timer then you must enter a number
for the Timer function like 0 (zero) for immediate executions.

This will fadein character EGO totally visible using normal speed, zero Timer and place the character
at the new given co-ordinates.

Now also if NPC characters are totally invisible (100) they are moved automatically to Room (-1).
-----------------------------------------------------------------------

GUI's
Added the ability to fade in/out gui's

Commands:-
FadeGuiOut_NoBlock(gMaingui, 100, 0);
Will fade out the gui totally invisible with normal speed.

FadeGuiIn_NoBlock(gMaingui, 0, 0, 250);
Will fade in the gui totally visible using normal speed with a delay.

-----------------------------------------------------------------------
-----------------------------------------------------------------------

Version History:
2.29 Changed Max Characters to 300 per room.

2.28 Fixed game pausing while skip cutscene is used, lowered define values of
       Objects,Characters and Gui's per room to speed up module.

2.27 Fixed typo error at line #168. (Thanks Scorpiorus).

2.26 Added support of fading in/out of GUI's.

2.25 Changed module name to "FadingThingsNonBlocking".

2.24 Bug Fix - Able to constantly repeate fade in/out of Objects
                     and Characters under room repeatedly execute.

2.23 Bug Fix - Characters and Objects now fade into current room
                     properly with Timer function.

2.22 Characters can now use optional new coordinates when
       fading in or use orignial coordinates.

2.21 Objects with a transparency of 100 will be turned off
       automatically.

2.20 NPC Characters with a transparency of 100 will be moved to
       room(-1). But NOT the player Character.

2.19 Characters are now able to be faded in from another room
       to player room. No need to set transparency before hand.

2.18 Objects can now be turned on within fade in function.
       No need to set transparency before hand.

2.17  Bug Fix - Fading in/out works when game is being skipped,
                      for example by the enter key.

2.16 Too many things to list.
#11
I've tried both examples you suggested and both give the same error "null pointer reference" on mouse click.
This happens as soon as I click anywhere on the screen.

Here's the on mouse click
Code: ags

function on_mouse_click(int button) {////////////////////////////////////On Mouse Click///////////////On Mouse Click
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  
// Store type, name and id# of what the player clicked 
// on in global variables GSloctype,GSlocname & GSlocid:
//-----------------------------------------------------

 int mrx=mouse.x+GetViewportX(), mry=mouse.y+GetViewportY();
 GSloctype=GetLocationType(mouse.x,mouse.y);
 InventoryItem *ii=InventoryItem.GetAtScreenXY(mouse.x,mouse.y);
 if (GSloctype==1) {
Ã,  Ã, Hotspot *hh=Hotspot.GetAtScreenXY(mouse.x,mouse.y);
Ã,  Ã, GSlocid=hh.ID;
 } else if (GSloctype==2) {
Ã,  Ã, Character *cc=Character.GetAtScreenXY(mouse.x,mouse.y);
	 GSlocid=cc.ID;
 } else if (GSloctype==3) {
Ã,  Ã, Object *oo=Object.GetAtScreenXY(mouse.x,mouse.y);
	 GSlocid=oo.ID;
 } else if (ii!=null) {
	 GSlocid=ii.ID;
 }
 GSlocname=Game.GetLocationName(mouse.x,mouse.y);

//-----------------------------------------------------

 if (IsGamePaused() == 1) {
Ã,  Ã,  // Game is paused, so do nothing (ie. don't allow mouse click)
Ã,  }

//	Handling clicks in map rooms:
//-----------------------------------------------------
Ã,  else if (gMaps.Visible){// if map
Ã,  Ã,  if (button==eMouseLeft){
Ã,  Ã,  Ã,  if (IsInteractionAvailable(mouse.x,mouse.y,eModeUse)) ProcessClick(mouse.x,mouse.y,eModeUse);
Ã,  Ã,  Ã,  else ProcessClick(mouse.x,mouse.y,0);
Ã,  Ã,  }
Ã,  }//end if map
//-----------------------------------------------------

//	Handling room clicks:
//-----------------------------------------------------
Ã,  else if (button==eMouseLeft || button==eMouseRight) {

Ã,  Ã,  String invname;
Ã,  Ã,  if (player.ActiveInventory!=null) invname = player.ActiveInventory.Name;

Ã,  Ã,  if (button==eMouseRight) SetMode(GetDefaultAction(mouse.x,mouse.y));// set the default mode when right click
Ã,  Ã,  
Ã,  Ã,  if (Extension(GSlocname)==EXITS_EXTENSION){// if its an 'exit'
Ã,  Ã,  Ã,  Ã,  HighlightActionBar();
Ã,  Ã,  Ã,  Ã,  WalkOffScreen(); 
Ã,  Ã,  }
Ã,  Ã,  // automatically give items to other player characters:
Ã,  Ã,  else if (ALWAYS_GIVE_ITEMS_TO_PLAYERS==1 && ExtensionEx(2,invname)!='d' && Mode(GIVE) && GetAGSMode(GIVE)==4 && GSloctype==2 && GSlocid<MAX_PLAYERS){
Ã,  Ã,  Ã,  if (GoToCharacter(GSlocid,0,1,2)){
Ã,  Ã,  Ã,  Ã,  GiveInv(player.ActiveInventory,character[GSlocid]);

Ã,  Ã,  Ã,  Ã,  SetMode(DEFAULT);
Ã,  Ã,  Ã,  }
Ã,  Ã,  }
// ---------------------------------------------------
Ã,  Ã,  else if (ALWAYS_GO_TO_HOTSPOTS==1 && ExtensionEx(2,GSlocname)!='d' && GetLocationType(mouse.x,mouse.y)!=0 ){
Ã,  Ã,  Ã,  Ã, UpdateActionBar(mrx,mry);
Ã,  Ã,  Ã,  Ã, HighlightActionBar();
Ã,  Ã,  Ã,  Ã, if (Go()==1) ProcessAction(GetMode(),mrx,mry);
Ã,  Ã,  Ã,  Ã, return;
Ã,  Ã,  }
Ã,  Ã,  else ProcessAction(GetMode(),mrx,mry);
Ã,  }


//-----------------------------------------------------

//	Handling inventory clicks:
//-----------------------------------------------------
Ã,  else if (button == eMouseLeftInv || button==eMouseRightInv){//click in inventory
Ã,  Ã,  if (button == eMouseLeftInv){
Ã,  Ã,  Ã,  if (GlobalCondition(1)) SetMode(SPECIAL_INV_MODE); //if walk or pickup mode in inventory
Ã,  Ã,  }
Ã,  Ã,  else if (button == eMouseRightInv){
Ã,  Ã,  Ã,  SetMode(GetDefaultAction(mouse.x,mouse.y));
Ã,  Ã,  } 
Ã,  Ã,  ProcessInventoryAction(GSmode,GSlocid);Ã,  
Ã,  }


#12
I get an error saying "cannot convert inventoryitem to int" here's the original

Code: ags

Ã,  else if (button==eMouseLeft || button==eMouseRight) {

Ã,  Ã,  string invname;
Ã,  Ã,  if (character[GetPlayerCharacter()].activeinv>=0) GetInvName(character[GetPlayerCharacter()].activeinv, invname);

Ã,  Ã,  if (button==eMouseRight) SetMode(GetDefaultAction(mouse.x,mouse.y));// set the default mode when right click
Ã,  Ã,  
Ã,  Ã,  if (Extension(GSlocname)==EXITS_EXTENSION){// if its an 'exit'
Ã,  Ã,  Ã,  Ã,  HighlightActionBar();
Ã,  Ã,  Ã,  Ã,  WalkOffScreen(); 
Ã,  Ã,  }
Ã,  Ã,  // automatically give items to other player characters:
Ã,  Ã,  else if (ALWAYS_GIVE_ITEMS_TO_PLAYERS==1 && ExtensionEx(2,invname)!='d' && Mode(GIVE) && GetAGSMode(GIVE)==4 && GSloctype==2 && GSlocid<MAX_PLAYERS){
Ã,  Ã,  Ã,  if (GoToCharacter(GSlocid,0,1,2)){

Ã,  Ã,  Ã,  Ã, GiveInv(character[GetPlayerCharacter()].activeinv,GSlocid);

Ã,  Ã,  Ã,  Ã,  SetMode(DEFAULT);
Ã,  Ã,  Ã,  }
Ã,  Ã,  }
// ---------------------------------------------------
Ã,  Ã,  else if (ALWAYS_GO_TO_HOTSPOTS==1 && ExtensionEx(2,GSlocname)!='d' && GetLocationType(mouse.x,mouse.y)!=0 ){
Ã,  Ã,  Ã,  Ã, UpdateActionBar(mrx,mry);
Ã,  Ã,  Ã,  Ã, HighlightActionBar();
Ã,  Ã,  Ã,  Ã, if (Go()==1) ProcessAction(GetMode(),mrx,mry);
Ã,  Ã,  Ã,  Ã, return;
Ã,  Ã,  }
Ã,  Ã,  else ProcessAction(GetMode(),mrx,mry);
Ã,  }


And here's what I have so far, I had to also add
Character *charid;
InventoryItem *invitem;
As I got an undefined token with the "GiveInv(invitem, charid);"
Code: ags

Ã,  else if (button==eMouseLeft || button==eMouseRight) {

Ã,  Ã,  String invname;
Ã,  Ã,  if (player.ActiveInventory>=0) invname = player.ActiveInventory.Name;


Ã,  Ã,  if (button==eMouseRight) SetMode(GetDefaultAction(mouse.x,mouse.y));// set the default mode when right click
Ã,  Ã,  
Ã,  Ã,  if (Extension(GSlocname)==EXITS_EXTENSION){// if its an 'exit'
Ã,  Ã,  Ã,  Ã,  HighlightActionBar();
Ã,  Ã,  Ã,  Ã,  WalkOffScreen(); 
Ã,  Ã,  }
Ã,  Ã,  // automatically give items to other player characters:
Ã,  Ã,  else if (ALWAYS_GIVE_ITEMS_TO_PLAYERS==1 && ExtensionEx(2,invname)!='d' && Mode(GIVE) && GetAGSMode(GIVE)==4 && GSloctype==2 && GSlocid<MAX_PLAYERS){
Ã,  Ã,  Ã,  if (GoToCharacter(GSlocid,0,1,2)){

Character *charid;
InventoryItem *invitem;
Ã,  Ã,  Ã,  Ã, GiveInv(invitem, charid);

Ã,  Ã,  Ã,  Ã,  SetMode(DEFAULT);
Ã,  Ã,  Ã,  }
Ã,  Ã,  }

#13
Would I be right with turning this
Code: ags

GiveInv(character[GetPlayerCharacter()].activeinv,GSlocid);

into this as the function is now
GiveInv(InventoryItem *invitem, Character *charid)
Code: ags

GiveInv(invitem, charid);


and my next question is with this code
Code: ags

if (character[GetPlayerCharacter()].activeinv>=0) GetInvName(character[GetPlayerCharacter()].activeinv, invname);

I've tried this
Code: ags

if (player.ActiveInventory>=0) player.ActiveInventory.Name;

but it's not working any helk would be grateful
#14
I'm assuming my last code is okay, as I would like to check that this next function is right.
Here's the original
Code: ags

function WalkOffScreen(){
 //handles the action of hotspots with exit extension ('>e' by default).
 //double click in such hotspots/objects... will make the player skip
 //walking to it. Look the documentation for more information on exits.
Ã,  if (IsTimerExpired(19)==1){ 
Ã,  Ã,  SetTimer(19,GetGameSpeed()/3);
Ã,  Ã,  if (Go()){
Ã,  Ã,  Ã,  int x=character[GetPlayerCharacter()].x,y=character[GetPlayerCharacter()].y;

Ã,  Ã,  Ã,  int offset=30;
Ã,  Ã,  Ã,  int dir=ExtensionEx(2,GSlocname);
Ã,  Ã,  Ã,  ifÃ,  Ã,  Ã,  (dir=='u') y-=offset;
Ã,  Ã,  Ã,  else if (dir=='d') y+=offset;
Ã,  Ã,  Ã,  else if (dir=='l') x-=offset;
Ã,  Ã,  Ã,  else if (dir=='r') x+=offset;
Ã,  Ã,  Ã,  if (MovePlayerEx(x,y,1)==1)
Ã,  Ã,  Ã,  Ã,  RunHotspotInteraction(GSlocid,9);
Ã,  Ã,  }
Ã,  }
Ã,  else RunHotspotInteraction(GSlocid,9);
}


And here's mine.
Code: ags

function WalkOffScreen(){

Ã,  if (IsTimerExpired(19)==1){ 
Ã,  Ã,  SetTimer(19,GetGameSpeed()/3);
Ã,  Ã,  if (Go()){
Ã,  Ã,  Ã,  int x=character[player.ID].x,y=character[player.ID].y;// <---Here

Ã,  Ã,  Ã,  int offset=30;
Ã,  Ã,  Ã,  int dir=ExtensionEx(2,GSlocname);
Ã,  Ã,  Ã,  ifÃ,  Ã,  Ã,  (dir=='u') y-=offset;
Ã,  Ã,  Ã,  else if (dir=='d') y+=offset;
Ã,  Ã,  Ã,  else if (dir=='l') x-=offset;
Ã,  Ã,  Ã,  else if (dir=='r') x+=offset;
Ã,  Ã,  Ã,  if (MovePlayerEx(x,y,1)==1)
Ã,  Ã,  Ã,  Ã, hotspot[GSlocid].RunInteraction(9);//<---Here
Ã,  Ã,  }
Ã,  }
Ã,  else hotspot[GSlocid].RunInteraction(9);//<---Here
}


*Edit*
My next problem is with
Code: ags

Ã,  else if (button==eMouseLeft || button==eMouseRight) {

Ã,  Ã,  string invname;
Ã,  Ã,  if (character[GetPlayerCharacter()].activeinv>=0) GetInvName(character[GetPlayerCharacter()].activeinv, invname);
Ã,  Ã,  if (button==eMouseRight) SetMode(GetDefaultAction(mouse.x,mouse.y));// set the default mode when right click
Ã,  Ã,  
Ã,  Ã,  if (Extension(GSlocname)==EXITS_EXTENSION){// if its an 'exit'
Ã,  Ã,  Ã,  Ã,  HighlightActionBar();
Ã,  Ã,  Ã,  Ã,  WalkOffScreen(); 
Ã,  Ã,  }
Ã,  Ã,  // automatically give items to other player characters:
Ã,  Ã,  else if (ALWAYS_GIVE_ITEMS_TO_PLAYERS==1 && ExtensionEx(2,invname)!='d' && Mode(GIVE) && GetAGSMode(GIVE)==4 && GSloctype==2 && GSlocid<MAX_PLAYERS){
Ã,  Ã,  Ã,  if (GoToCharacter(GSlocid,0,1,2)){
Ã,  Ã,  Ã,  Ã, GiveInv(character[GetPlayerCharacter()].activeinv,GSlocid);
Ã,  Ã,  Ã,  Ã,  SetMode(DEFAULT);
Ã,  Ã,  Ã,  }
Ã,  Ã,  }


I've tried this but doesn't work
Code: ags

Ã,  else if (button==eMouseLeft || button==eMouseRight) {
if (player.ActiveInventory>=0) player.ActiveInventory.Name;//<---here
Ã,  Ã,  if (button==eMouseRight) SetMode(GetDefaultAction(mouse.x,mouse.y));// set the default mode when right click
Ã,  Ã,  
Ã,  Ã,  if (Extension(GSlocname)==EXITS_EXTENSION){// if its an 'exit'
Ã,  Ã,  Ã,  Ã,  HighlightActionBar();
Ã,  Ã,  Ã,  Ã,  WalkOffScreen(); 
Ã,  Ã,  }
Ã,  Ã,  // automatically give items to other player characters:
Ã,  Ã,  else if (ALWAYS_GIVE_ITEMS_TO_PLAYERS==1 && ExtensionEx(2,invname)!='d' && Mode(GIVE) && GetAGSMode(GIVE)==4 && GSloctype==2 && GSlocid<MAX_PLAYERS){
Ã,  Ã,  Ã,  if (GoToCharacter(GSlocid,0,1,2)){
Ã,  Ã,  Ã,  Ã, GiveInv(character[GetPlayerCharacter()].activeinv,GSlocid);
Ã,  Ã,  Ã,  Ã,  SetMode(DEFAULT);
Ã,  Ã,  Ã,  }
Ã,  Ã,  }

And how would I change
Code: ags

GiveInv(character[GetPlayerCharacter()].activeinv,GSlocid);

As I think it is linking to the function
Code: ags

function GiveInv(InventoryItem *invitem, Character *charid){


Thanks in advance
#15
Thanks Ashen
Yes MAX_PLAYERS is defined with this
Code: ags

#define MAX_PLAYERS 3//Put here how many player characters your game has

My next problem, am I right with turning this
Code: ags

if (Tposition[counter].smallpicbevelbutton==GetGUIObjectAt(mouse.x,mouse.y) ){

into this
Code: ags

if (gMaingui.Controls[Tposition[counter].smallpicbevelbutton]){


If this is okay then would this
Code: ags

Ã,  string buffer;
Ã,  string madetext;
Ã,  int mode;
Ã,  mode=GSmode;

if (Tposition[counter].smallpicbevelbutton== GUIControl.GetAtScreenXY(mouse.x, mouse.y){
 GetInvName(character[GetPlayerCharacter()].activeinv,buffer);
 RemoveExtension(buffer);
 StrFormat(madetext,"%s %s %s %s",Tmode[GIVE].name,buffer,Tmode[GIVE].preposition,character[Tposition[counter].charac].name);
Ã, }


turn into this?
Code: ags

Ã,  String buffer;
Ã,  String madetext;
Ã,  int mode;
Ã,  mode=GSmode;

if (gMaingui.Controls[Tposition[counter].smallpicbevelbutton] ){
 madetext=String.Format("%s %s %s %s", madetext, Tmode[GIVE].name, RemoveExtension(player.ActiveInventory.Name), Tmode[mode].preposition);
}

#16
Thanks SSH
I've been using your code from MI2 template into this template hope you don't mind.

My next problem is with
Code: ags

function GlobalConditionEx(int parameter, int roomx, int roomy){
// here are some conditions that are used many times in the script
Ã,  if (parameter==1){//if the mouse is in the inventory and modes Walk or pickup are selected
Ã,  Ã,  return ( GetInvAt(roomx-GetViewportX(),roomy-GetViewportY())>=0 && (GetAGSMode(GetMode())==9 || GetAGSMode(GetMode())==5) );
Ã,  }
Ã,  else if (parameter==2){//if the mode is useinv and the mouse is over the active inv (like "use knife on knife")
Ã,  Ã,  return (character[GetPlayerCharacter()].activeinv==GetInvAt(mouse.x,mouse.y) && GetAGSMode(GetMode())==4);
Ã,  }
Ã,  else if (parameter==3){//if the mode is talk, or "Give", and the mouse isnt over a character
Ã,  Ã,  return (Ã,  Ã, (GetAGSMode(GetMode())==MODE_TALK || (Mode(GIVE) && GetAGSMode(GIVE)==4) ) && GetLocationType(roomx-GetViewportX(),roomy-GetViewportY())!=2Ã,  );
Ã,  }
Ã,  else if (parameter==4){//if its a 'only inventory' mode (like GIVE), and the mouse isnt over a inv.item
Ã,  Ã,  return (GetAGSMode(GetMode())==MODE_USE && Tmode[GSmode].onlyinv==1 && GetInvAt(mouse.x,mouse.y)<0);
Ã,  }
Ã,  else if (parameter==5){
Ã,  Ã,  int counter=1;
Ã,  Ã,  while (counter<MAX_PLAYERS){
Ã,  Ã,  Ã,  if (GetGUIAt(mouse.x,mouse.y)==MAINGUI && GetGUIObjectAt(mouse.x,mouse.y)==Tposition[counter].smallpicbevelbutton) return 1;
Ã,  Ã,  Ã,  counter++;
Ã,  Ã,  }
Ã,  Ã,  return 0;
Ã,  }
}

And I sort of ended up with this which I think is probably not right, haven't tried parameter 5 yet.
Code: ags

function GlobalConditionEx(int parameter, int roomx, int roomy){
// here are some conditions that are used many times in the script
Ã,  InventoryItem *ii=InventoryItem.GetAtScreenXY(mouse.x,mouse.y);
Ã,  if (parameter==1){//if the mouse is in the inventory and modes Walk or pickup are selected
Ã,  Ã,  return ( ii!=null && (roomx-GetViewportX(),roomy-GetViewportY())>=0 && (GetAGSMode(GetMode())==9 || (GetAGSMode(GetMode())==5) );
Ã,  }
Ã,  else if (parameter==2){//if the mode is useinv and the mouse is over the active inv (like "use knife on knife")
Ã,  Ã,  return (player.ActiveInventory==ii && GetAGSMode(GetMode())==4);
Ã,  }
Ã,  else if (parameter==3){//if the mode is talk, or "Give", and the mouse isnt over a character
Ã,  Ã,  return (Ã,  Ã, (GetAGSMode(GetMode())==eModeTalkto || (Mode(GIVE) && GetAGSMode(GetMode())==4) ) && GetLocationType(roomx-GetViewportX(),roomy-GetViewportY())!=2Ã,  );
Ã,  }
Ã,  else if (parameter==4){//if its a 'only inventory' mode (like GIVE), and the mouse isnt over a inv.item
Ã,  Ã,  return (GetAGSMode(GetMode())==eModeUse && Tmode[GSmode].onlyinv==1 && ii==null);
Ã,  }
Ã,  else if (parameter==5){
Ã,  Ã,  int counter=1;
Ã,  Ã,  while (counter<MAX_PLAYERS){
Ã,  Ã,  Ã,  if (GetGUIAt(mouse.x,mouse.y)==MAINGUI && GetGUIObjectAt(mouse.x,mouse.y)==Tposition[counter].smallpicbevelbutton) return 1;
Ã,  Ã,  Ã,  counter++;
Ã,  Ã,  }
Ã,  Ã,  return 0;
Ã,  }
}

function GlobalCondition(int parameter){
Ã,  return GlobalConditionEx(parameter, mouse.x+GetViewportX(), mouse.y+GetViewportY());
}


*EDIT*
Just realised that maybe parameter 1 could be
Code: ags

Ã,  if (parameter==1){//if the mouse is in the inventory and modes Walk or pickup are selected
Ã,  Ã,  return ( ii!=null && (GetAGSMode(GetMode())==9 || GetAGSMode(GetMode())==5) );

Just need help with parameter 5

any help would be grateful thanks again.
#17
How would I change this function as it is also linked with the "function GiveInv(InventoryItem *invitem, Character *charid){"

Code: ags

function GiveInvChronOJohn(int invitem, int charid){
Ã,  String invname;
Ã,  GetInvName(invitem, invname);
Ã,  if (ExtensionEx(3,invname)!='d') {
Ã,  Ã,  GSmode=GIVECHRON;
Ã,  Ã,  GSusedmode=GIVECHRON;
Ã,  Ã,  SetGraphicalVariable("Used Mode", GIVECHRON);
Ã,  Ã,  GiveInv(invitem, charid);
Ã,  Ã,  SetMode(DEFAULT);
Ã,  }
Ã,  else {
Ã,  //you could put here different messages or actions for different items when the player
Ã,  //tries to give them via the chron-o-john (i.e. the little icons in the GUI)
Ã,  //and it doesnt do the default behaviour (giving the item), because the second extension of 
Ã,  //that inventory item is 'd'.
Ã,  Ã,  if (invitem==2) Display("The hamster wouldn't survive to a Chron-O-John travel");//if tried to give the hamster
Ã,  Ã,  else Display ("I think i can't put that in the Chron-O-John"); //generic message
Ã,  }
}


Thanks in advance
#18
How do you mean? just leave out "invname" or the whole function?
If it's just the "invname" do you mean so that all that is left would be something like
Code: ags

 function GiveInv(int invitem, int charid){
Ã,  character[charid].inv[invitem]=player.ID.inv[invitem];
Ã,  player.ID.inv[invitem]=0;
Ã,  UpdateInventory();
Ã,  player.ID.activeinv=invitem;

Ã,  GSloctype=0;
Ã,  RunCharacterInteraction(charid, MODE_USEINV);
}

*Edit*
As this is also linked to this function
Code: ags

function GiveInvChronOJohn(int invitem, int charid){
Ã,  String invname;
Ã,  GetInvName(invitem, invname);
Ã,  if (ExtensionEx(3,invname)!='d') {
Ã,  Ã,  GSmode=GIVECHRON;
Ã,  Ã,  GSusedmode=GIVECHRON;
Ã,  Ã,  SetGraphicalVariable("Used Mode", GIVECHRON);
Ã,  Ã,  GiveInv(invitem, charid);
Ã,  Ã,  SetMode(DEFAULT);
Ã,  }
Ã,  else {
Ã,  //you could put here different messages or actions for different items when the player
Ã,  //tries to give them via the chron-o-john (i.e. the little icons in the GUI)
Ã,  //and it doesnt do the default behaviour (giving the item), because the second extension of 
Ã,  //that inventory item is 'd'.
Ã,  Ã,  if (invitem==2) Display("The hamster wouldn't survive to a Chron-O-John travel");//if tried to give the hamster
Ã,  Ã,  else Display ("I think i can't put that in the Chron-O-John"); //generic message
Ã,  }
}

which would be the next problem.
#19
Great that fixed that problem.
Now my next problem seems to be with the new "Strings" commands.
I have this code and it's saying "undefined token GetInvName"
here's the function in question
Code: ags

function GiveInv(int invitem, int charid){
Ã,  String invname;
Ã,  GetInvName(invitem,invname);

Ã,  character[charid].inv[invitem]=character[GetPlayerCharacter()].inv[invitem];
Ã,  character[GetPlayerCharacter()].inv[invitem]=0;
Ã,  UpdateInventory();
Ã,  character[GetPlayerCharacter()].activeinv=invitem;

Ã,  GSloctype=0;
Ã,  RunCharacterInteraction(charid, MODE_USEINV);
}

Also would I be right with using this code?
Code: ags

Ã,  character[charid].inv[invitem]=player.ID.inv[invitem];
Ã,  player.ID.inv[invitem]=0;
Ã,  UpdateInventory();
Ã,  player.ID.activeinv=invitem;

#20
I tried your shortened version of
Code: ags

Tposition[counter].smallpicbutton.NormalGraphic = Tplayer[player.ID].smallpic;

and this gave an error stating NormalGraphic is not a member of "int". So I used your second version which seems to work.

My next problem is with this code
Code: ags

if (Tmode[counter].button[charid]>=0) SetButtonPic(MAINGUI,Tmode[counter].button[charid],2,Tmode[counter].highlightedbutton[charid]);

I've tried this code below, but I get a Parse error in expr near "Tmode"
Code: ags

if (Tmode[counter].button[charid]>=0) gMaingui.Controls[Tmode[counter].button[charid]].AsButton.MouseOverGraphic = Tmode[counter].highlightedbutton[charid]);

I know I'm missing something but I cannot see it

*Edit*
Also would I be right with changing
Code: ags

Ã,  SetLabelColor(ACTION,0,Tplayer[charid].actionlabelcolor);

Ã,  Tplayer[GetPlayerCharacter()].topinvitem=game.top_inv_item;
Ã,  if (Tplayer[charid].topinvitem>=0) game.top_inv_item=Tplayer[charid].topinvitem;

Ã,  SetCharacterClickable(GetPlayerCharacter(),1);
Ã,  SetCharacterClickable(charid,0);
Ã,  StopMoving(charid);
Ã,  SetPlayerCharacter(charid);

To this
Code: ags

Ã,  labelStatus.TextColor = Tplayer[charid].actionlabelcolor;

Ã,  Tplayer[charid].topinvitem=MainInventory.TopItem;// MainInventory script name.
Ã,  if (Tplayer[charid].topinvitem>=0) MainInventory.TopItem=Tplayer[charid].topinvitem;

Ã,  character[player.ID].Clickable = 1;// Yes
Ã,  character[charid].Clickable = 0;Ã,  Ã, // No
Ã,  player.StopMoving();
Ã,  character[charid].SetAsPlayer();
Ã,  SetMode(DEFAULT);

SMF spam blocked by CleanTalk