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

#41
Yes it is in the repeatedly exec

and no that didn't work when I removed the line "mouse.Mode = eModeUseInv;"

Adding "player.ActiveInventory = null;" command seems to work ok now.

With regards to mouse inventory clicks I have:
Code: ags
 else if (button == eMouseLeftInv) {
Ã,  Ã,  player.ActiveInventory = inventory[game.inv_activated];
Ã,  Ã,  }
 else if (button == eMouseRightInv) {
Ã,  Ã,  inventory[game.inv_activated].RunInteraction(eModeLookat);
Ã,  Ã,  }
#42
I have tried your suggestion and added a new command for eMode.mouse == Interact which works ok.

The problem I have now is getting the Give command to work properly, I first had a Null pointer reference so I have changed this so it is similar to the mouse.Mode==eModeUseInv function which seemed to solve that problem.

The problem I have is that the Give function doesn't display "Give (inventory item) to" it displays the normal "Use (inventory item) with".

Also when using the Give mode it seems to remember the last inventory item used, it doesn't seem to clear if you can understand What I mean.

Here's what I have so far:
Code: ags
function SetActionText(){
Ã,  Ã,  string text;Ã,  
Ã,  if (mouse.Mode==eModeWalkto) StrCopy(text, "Walk to ");
Ã,  else if (mouse.Mode==eModeLookat) StrCopy(text, "Look at ");
Ã,  else if (mouse.Mode==eModePickup) StrCopy(text, "Pick up ");
Ã,  else if (mouse.Mode==eModeInteract) StrCopy(text, "Use ");// added

Ã,  else if (mouse.Mode==eModeUseInv) {
Ã,  Ã,  Ã,  StrCopy(text, "Use ");
Ã,  Ã,  if (player.ActiveInventory!=null) {
Ã,  Ã,  Ã,  mouse.Mode = eModeUseInv;
Ã,  Ã,  Ã,  string invname;
Ã,  Ã,  Ã,  player.ActiveInventory.GetName(invname);
Ã,  Ã,  Ã,  Ã, StrCat(text, invname);
Ã,  Ã,  Ã,  StrCat(text, " with ");
Ã,  Ã,  Ã, }
Ã,  Ã, }
Ã,  else if (mouse.Mode==eModeTalkto) StrCopy(text, "Talk to ");
Ã,  else if (mouse.Mode==eModePull) StrCopy(text, "Pull ");
Ã,  else if (mouse.Mode==eModePush) StrCopy(text, "Push ");
Ã,  else if (mouse.Mode==eModeOpen) StrCopy(text, "Open ");
Ã,  else if (mouse.Mode==eModeClose) StrCopy(text, "Close ");

Ã,  else if (mouse.Mode==eModeGive) {
Ã,  Ã,  StrCopy(text, "Give ");
Ã,  Ã,  if (player.ActiveInventory!=null) {
Ã,  Ã,  Ã,  mouse.Mode = eModeUseInv;
Ã,  Ã,  Ã,  string invname;Ã,  Ã,  
Ã,  Ã,  Ã,  player.ActiveInventory.GetName(invname);// was getting Null pointer error here
Ã,  Ã,  Ã,  StrCat(text, invname);
Ã,  Ã,  Ã,  StrCat(text, " to ");
Ã,  Ã,  Ã, }
Ã,  Ã, }

Ã,  Ã,  StrCat(text, "@OVERHOTSPOT@");
Ã,  Ã,  gActionStatus.SetText(text);
 }


Thanks again
#43
I had another idea with these cursors, am I supposed to define them?
All I have done is create new cursors

mouse.Mode=eModePush - cursor 10
mouse.Mode=eModePull - cursor 11
mouse.Mode=eModeOpen - cursor 12
mouse.Mode=eModeClose - cursor 13
mouse.Mode=eModeGive - cursor 14

#44
Okay I tried your suggestion and it doesn't quite work,
when I click "use" then on inventory item the status line shows the "use" then disappears leaving inventory item showing eg; "voodoo doll" , it also doesn't displayÃ,  "with" either.

And for some reason it doesn't clear the command as I can keep clicking on an object as if I was using an inventory item.

And I can't get the other mouse modes to change back after use for:
Code: ags
Ã,  else if (mouse.Mode==eModePull) StrCopy(text, "Pull ");
Ã,  else if (mouse.Mode==eModePush) StrCopy(text, "Push ");
Ã,  else if (mouse.Mode==eModeOpen) StrCopy(text, "Open ");
Ã,  else if (mouse.Mode==eModeClose) StrCopy(text, "Close ");

when the other commands work okay eg:
Code: ags
 else if (mouse.Mode==eModeLookat) StrCopy(text, "Look at ");
else if (mouse.Mode==eModePickup) StrCopy(text, "Pick up ");
 else if (mouse.Mode==eModeInteract) StrCopy(text, "Use ");
else if (mouse.Mode==eModeTalkto) StrCopy(text, "Talk to ");
#45
Advanced Technical Forum / status line setup
Wed 08/03/2006 10:05:28
I'm in the process of making a new template and I'm having problems with defining between the use and give inventory items, in that I can get one or the other to work but not both.
here's what I have so far:
Code: ags
function SetActionText(){Ã,  
Ã,  string text;
Ã,  if (mouse.Mode==eModeWalkto) StrCopy(text, "Walk to ");
Ã,  else if (mouse.Mode==eModeLookat) StrCopy(text, "Look at ");
Ã,  else if (mouse.Mode==eModePickup) StrCopy(text, "Pick up ");
Ã,  else if (mouse.Mode==eModeInteract) StrCopy(text, "Use ");
Ã,  else if (mouse.Mode==eModeTalkto) StrCopy(text, "Talk to ");
Ã,  
Ã,  else if (mouse.Mode==eModePull) StrCopy(text, "Pull ");
Ã,  else if (mouse.Mode==eModePush) StrCopy(text, "Push ");
Ã,  else if (mouse.Mode==eModeOpen) StrCopy(text, "Open ");
Ã,  else if (mouse.Mode==eModeClose) StrCopy(text, "Close ");
Ã,  
Ã,  else if (mouse.Mode==eModeGive) {
Ã,  Ã, mouse.Mode = eModeUseInv;
Ã,  Ã,  string invname;
Ã,  Ã,  StrCopy(text, "Give ");
Ã,  Ã,  player.ActiveInventory.GetName(invname); 
Ã,  Ã,  StrCat(text, invname);
Ã,  Ã,  StrCat(text, " to ");
Ã,  }
//Ã,  else if (mouse.Mode==eModeUseInv){// If using an inventory item on something
Ã,  else if (mouse.Mode==eModeInteract){
Ã,  Ã, mouse.Mode = eModeUseInv;
Ã,  Ã,  string invname;
Ã,  Ã,  StrCopy(text, "Use ");
Ã,  Ã,  player.ActiveInventory.GetName(invname); 
Ã,  Ã,  StrCat(text, invname);
Ã,  Ã,  StrCat(text, " with ");
Ã,  }

Ã,  Ã,  StrCat(text, "@OVERHOTSPOT@");
		
Ã,  Ã,  gActionStatus.SetText(text);
}


Any help would be grateful

Also while I think about it I can't seem to get these

Code: ags
Ã,  else if (mouse.Mode==eModePull) StrCopy(text, "Pull ");
Ã,  else if (mouse.Mode==eModePush) StrCopy(text, "Push ");
Ã,  else if (mouse.Mode==eModeOpen) StrCopy(text, "Open ");
Ã,  else if (mouse.Mode==eModeClose) StrCopy(text, "Close ");


working quite right in that they don't reset the statusline back to walk to command when used.

#46
Thanks khrismuc
Thats what I was looking for
#47
Hi I have this function which is pretty basic where when the mouse passes over objects,hotspots and characters it highlights the buttons (changes the Look at & Talk to sprites), which works okay. But now I also want it to also highlight the buttons when the mouse is over inventory items.

heres what I have so far:
Code: ags
	function HighlightButtons() {

if (GetLocationType(mouse.x,mouse.y) == eLocationCharacter)
Ã,  gMainTalkto.NormalGraphic = 89;// Highlight Talk To

else if (GetLocationType(mouse.x,mouse.y) == eLocationHotspot)
Ã,  gMainLook.NormalGraphic = 84;// Highlight Look At

else if (GetLocationType(mouse.x,mouse.y) == eLocationObject)
Ã,  gMainLook.NormalGraphic = 84;// Highlight Look At

else if (GetLocationType(mouse.x, mouse.y) == eLocationNothing)
Ã,  gMainLook.NormalGraphic = 73;// Look At Normal
Ã,  gMainTalkto.NormalGraphic = 78;// Talk To Normal		
}


Any help would be grateful
#48
Thanks again for all the help

I guess it would be better if they happened one after the other, so I wouldn't need to use the "wait" between commands.

And yes the bootup picture is a bit frighteningÃ,  :o
#49
That seems to do the trick the object now fades in, I also added an opening brace on the end of "if (fadeobj.Visible == false)"
hope thats right.
Code: ags
function FadeObjectIn (Object *objectpoint,int value,int speed) {
Ã,  if (fadein) return 1;
Ã,  fadeobj = objectpoint;
Ã,  if (fadeobj.Visible == false) { // <--- Brace here?
Ã,  Ã,  fadeobj.Transparency = 100;
Ã,  Ã,  fadeobj.Visible = true;
 // 'fadeobj' and 'objectpoint' both refer to the same object - I've kept the useage consistant for clarity
	}
Ã,  transparent = fadeobj.Transparency;
Ã,  fadein=1;
Ã,  fadespeed = speed;
Ã,  fadecounter = speed;
Ã,  fadelimit = value;
}

the only problem now is trying to sort out is getting the functions to work seperate because the only way to get two or more objects to fade in or out, is to revert back to
Code: ags
function repeatedly_execute_always() {

and the in a script to use a wait command otherwise it seems to miss the first command and go staight to the last fade object, if that makes any sense eg,
Code: ags
FadeObjectIn(oDoll,0,2);
Wait(200);
FadeObjectOut(oFly,50,2);


As for FadeIn/OutQueued functions I wouldn't know where to start so any other help would be grateful
#50
The object now turns on but doesn't fade in, it appears instantly here'sÃ,  the code:
Code: ags
function FadeObjectIn (Object *objectpoint,int value,int speed) {
	if (fadein) return 1;
	fadeobj = objectpoint;
	transparent = fadeobj.Transparency;

	objectpoint.Transparency = transparent;
	objectpoint.Visible = true;

	fadein=1;
	fadespeed = speed;
	fadecounter = speed;
	fadelimit = value;
}


am I placing it in the right place?

Also using the "Wait(1);" command in the function causes the mouse pointer and the status line to flash like mad until the function finishes.
#51
Also I have a problem with

Code: ags
function FadeCharacterOut (int CharID, int speed) {
if (fading) return 1; //aborts if fading is currently being executedÃ,  
transparent=0;Ã,  
fadespeed = speed;Ã,  
fadecounter=fadespeed;Ã,  
fading=1;
}

Then in "repeatedly_execute" ("_always" if you don't want it to be blocked by anything) add:

if (fading) {Ã,  
if (transparent < 100) {
Ã,  Ã,  fadecounter--;
Ã,  Ã,  if (fadecounter<0) {
Ã,  Ã,  Ã,  fadecounter=fadespeed;
Ã,  Ã,  Ã,  transparent += 1; 
Ã,  Ã,  Ã, SetCharacterTransparency (CharID, transparent);
Ã,  Ã,  }
Ã,  } else fading=0;
} 


The problem is with "SetCharacterTransparency (CharID, transparent);"
undifined symbol 'CharID
any would be grateful thanks
#52
Thanks for the replies

After experimenting with your codes is there away to turn on objects so that I don't have to set the objects transparency before player enters screen ie..
Code: ags
object[3].Transparency =100;

and without having the "object is initially visible" ticked?

I was able to do this with my previous funtion for example:
Code: ags
function FadeObjectIn (int objectid) {
Ã,  transparent =100;
Ã,  ObjectOn(objectid); // Turning object on
Ã,  while (transparent > 0) {
Ã,  SetObjectTransparency (objectid, transparent);
Ã,  transparent --;
Ã,  Wait (1); }
}


Here's the code at the moment I'm using:
Code: ags
function FadeObjectIn (Object *objectpoint,int value,int speed) {
Ã,  if (fadein) return 1;
Ã,  fadeobj = objectpoint;
Ã,  transparent = fadeobj.Transparency;
//Ã,  object[objectpoint].Visible == true; // trying to turn object on
//	ObjectOn(objectpoint);Ã,  
Ã,  fadein=1;
Ã,  fadespeed = speed;
Ã,  fadecounter = speed;
Ã,  fadelimit = value;
}


function repeatedly_execute_always() {
Ã,  if (fadeout) {
Ã,  Ã,  if (transparent < fadelimit) {
Ã,  Ã,  Ã,  fadecounter--;
Ã,  Ã,  Ã,  if (fadecounter<0) {
Ã,  Ã,  Ã,  Ã,  fadecounter=fadespeed;
Ã,  Ã,  Ã,  Ã,  transparent ++;
Ã,  Ã,  Ã,  Ã,  fadeobj.Transparency = transparent;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  } else fadeout=0;
Ã,  Ã,  } 
//----------------------------------------------------------------
Ã,  if (fadein) {
Ã,  Ã,  if (transparent > fadelimit) {
Ã,  Ã,  Ã,  fadecounter++;
Ã,  Ã,  Ã,  if (fadecounter>0) {
Ã,  Ã,  Ã,  Ã,  fadecounter=fadespeed;
Ã,  Ã,  Ã,  Ã,  transparent --;
Ã,  Ã,  Ã,  Ã,  fadeobj.Transparency = transparent;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã, } else fadein=0;
Ã,  Ã, } 
}
//----------------------------------------------------------------

function on_event (EventType event, int data) {
Ã,  if (event == eEventLeaveRoom && fadeout) {
Ã,  fadeout = 0;Ã,  //reset, so won't crash in next room
Ã,  fadeobj.Transparency = 0;
Ã,  }
//----------------------------------------------------------------
Ã,  if (event == eEventLeaveRoom && fadein) {
Ã,  fadein = 0;Ã,  //reset, so won't crash in next room
Ã,  Ã, fadeobj.Transparency = 100;
Ã,  }
}


Also the nonblocking isn't quite what I was expecting for example
when running a script where two or more objects fade in or out it goes staight to the last object, the only way to stop this was by using the wait command ie..
Code: ags
FadeObjectOut(oDoll, 50, 2);
Wait(200);
FadeObjectIn(oFly, 50, 5);
Wait(200);
FadeObjectIn(oTom, 0, 5);


so is there away to make these blocking instead
thanks again
#53
Thanks for the help I'll try that later

also would that effect my other function

Code: ags
function FadeObjectIn (int objectid,int value,int speed) {
		transparent=100;
		ObjectOn(objectid);
	while (transparent > value) {
		transparent --;		Ã,  
		SetObjectTransparency (objectid, transparent);
		Wait (speed); }
}
#54
Just realised that I'm not using that function before, instead I'm using this one

Code: ags
function FadeObjectOut (int objectid,int value,int speed) {
		transparent=(object[objectid].Transparency);
	while (transparent < value) {
		transparent ++;	Ã,  
		SetObjectTransparency (objectid, transparent);
		Wait (speed); }
}


and I'm turning these functions in a module so would I need to export the code you mentioned in the repeatedly execute?
#55
Hi I have another question at the moment I have this function
Code: ags
function FadeCharacterOut (int charID, int speed) {
Ã,  transparent=0;
Ã,  while (transparent <= 100) {
Ã,  SetCharacterTransparency (charID, transparent);
Ã,  transparent += 1;
Ã,  Wait (speed); }
} 


What I would like is some sort of speed function that can replace the "wait" command and is if possible non blocking, because if someone enters a speed value of 0, the "wait" command doesn't like it
#56
I have another question
At the moment I'm using this code in the room 89 repeatedly execute.

Code: ags
if (object[2].Visible == true && object[2].Graphic == 1226) {
Ã,  SetGlobalInt(30, 1);
	}
	else SetGlobalInt(30, 0);

if (object[3].Visible == true && object[3].Graphic == 1222) {
Ã,  SetGlobalInt(31, 1);
	}
	else SetGlobalInt(31, 0);

if (object[6].Visible == true && object[6].Graphic == 1228) {
Ã,  SetGlobalInt(32, 1);
	}
	else SetGlobalInt(32, 0);

if (object[9].Visible == true && object[9].Graphic == 1232) {
Ã,  SetGlobalInt(33, 1);
	}
	else SetGlobalInt(33, 0);


if ((GetGlobalInt(30) == 1) && (GetGlobalInt(31) == 1) && (GetGlobalInt(32) == 1) && (GetGlobalInt(33) == 1)){
Ã,  Display("Congratulations you've solved this puzzle");
Ã,  Wait(100);
Ã,  player.ChangeRoom (90);
}


which works okay, but I was then thinking of changing this so I got a reply when each puzzle was completed like this for example:

Code: ags
if (GetGlobalInt(30) == 1){
	Display("This one is correct");
	SetGlobalInt(34, 1);
	}
	else SetGlobalInt(30, 0);

if (GetGlobalInt(31) == 1){
	Display("This one looks right");
	SetGlobalInt(35, 1);
	}
	else SetGlobalInt(31, 0);
 
if (GetGlobalInt(32) == 1){
	Display("Well done this one is solved");
	SetGlobalInt(36, 1);
	}
	else SetGlobalInt(32, 0); 
 
	if (GetGlobalInt(33) == 1){
	Display("You've solved this one");
	SetGlobalInt(37, 1);
	}
	else SetGlobalInt(33, 0); 


if ((GetGlobalInt(34) == 1) && (GetGlobalInt(35) == 1) && (GetGlobalInt(36) == 1) && (GetGlobalInt(37) == 1)){
	Display("Congratulations you've solved all the puzzles");
	Wait(100);
	player.ChangeRoom (90);
}


But when I try this all that happens is for example depending on which puzzle is done "Display("This one looks right");" keeps repeating and not letting me do enything else, is there away so it only happens once? so the player then go and solve the other three puzzles.

thanks in advance
#57
Thanks for the help works perfect now
#58
Hi
I'm having problems with setting an object properties and checking if the object image is a certain number to run the global int.

Basically the objects image number to start with is 1218 and after an interaction the image changes to 1226 which works ok,
Then I want to check if the image has changed to run another interaction when the object is visible.

I keep getting a parse error near 'object'
any help would be grateful thanks

Here's my example:

Code: ags
if	(ObjectOn(2) && (object[2].Graphic = 1226);){
Ã,  	SetGlobalInt (30, 1); 
	}
#59
Thanks for the hard work I would never have come up with that solution.

Edit:
I did some testing and when player changes their mind while walking to an (object1) works fine if they cancel with the "walk to" command.

But if say they change their mind and "look at" another (object2) the interaction for "look at" runs (object2), then the interaction for (object1) then continues.

Is there away for any sort of interation to cancel the first interaction?

Many thanks again

Edit:
Thats fixed it thank you again Ashen
#60
Ok
Code: ags
player.Walk(mouse.x, mouse.y, eBlock);

works.
how do you go about storing the coordinates if they change there mind while walking to the object?
SMF spam blocked by CleanTalk