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

#161
Thanks for ur returning and answer. I thought you gave up  ;-D

I think I've tried this before because what's happening with this method has happened to me before, and what's happening is that it's wrong interaction again. It goes in the function directly to ELSE again and ignores IF and ELSE IF. Our example: Bread with honey, Jesus says: it doesn't work, instead of combining them together.

QuoteI don't think the repeatedly_execute_always is a "wrong" place, with that it may work all the time regardless of other things you do in rep-exec.

Okay. I will leave it there then. It doesn't cause any problems so far. I think that is the only solution. I don't know why but that is what it looks like.
#162
It works there.

Code: ags

function repeatedly_execute_always() 
{   
if (DragDrop.EvtDropped)
{
  player.ActiveInventory = null;
}

}


But I don't know if this is its right place.
#163
Quote from: Crimson Wizard on Tue 06/07/2021 12:33:27
I cannot tell without seeing full code of rep exec.

Ok.

Code: ags


Hotspot* prevH;

function repeatedly_execute() 
{  
  
 int x = mouse.x -280;
 int y = mouse.y -115; 
  InventoryItem*ii = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
  Label*lbl = gGui1.Controls[0].AsLabel;
  String text;
  if (ii) text = ii.Name;
  else text = Game.GetLocationName(mouse.x, mouse.y);
  
 gGui1.SetPosition(x, y);  // name over verbcoins
  

 
Character *chara = Character.GetAtScreenXY(mouse.x, mouse.y);
Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
Hotspot *hot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
InventoryItem *inv = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);

if (DragDrop.EvtWantDrop)
{

  cJesus.ActiveInventory = DragDropCommon._InvItem;
  
  if ((chara != null) || (obj != null) || (hot != hotspot[0]))
  {
   ProcessClick(mouse.x, mouse.y, eModeUseinv);

  }
  
    else if (inv != null) 
  {
    
    inv.RunInteraction(eModeUseinv);
    
  }
}
 

else if (DragDrop.EvtDragStarted) // || (DragDrop.EvtDropped))
  {
    player.ActiveInventory = null;
  }
 
 /*
else
{
player.ActiveInventory = null;  // it works but not a good idea coz the name of objects over the verbcoins doesn't appear any more
}
*/





/////////// Pfeile an Hotspots


Hotspot* currentH = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (currentH != prevH) {
int pfeil = currentH.GetProperty("Pfeil");
if (pfeil == 1)
{
mouse.ChangeModeGraphic(eModeWalkto, 236);  
mouse.ChangeModeView(eModeWalkto, 24);
cJesus.Clickable = false;
}  
if (pfeil == 2)
{
mouse.ChangeModeGraphic(eModeWalkto, 232);  
mouse.ChangeModeView(eModeWalkto, 23);  
cJesus.Clickable = false;
}  
if (pfeil == 3)
{
mouse.ChangeModeGraphic(eModeWalkto, 240);  
mouse.ChangeModeView(eModeWalkto, 25); 
cJesus.Clickable = false;
}
if (pfeil == 4)
{
mouse.ChangeModeGraphic(eModeWalkto, 228);  
mouse.ChangeModeView(eModeWalkto, 22);
cJesus.Clickable = false;
}

if (pfeil == 0 || currentH.ID == 0) 
{

mouse.ChangeModeGraphic(eModeWalkto, 217);
mouse.ChangeModeView(eModeWalkto, 21);
cJesus.Clickable = true;
} 
if ((gMainmenu2.Transparency == 0) && (pfeil == currentH.GetProperty("Pfeil")))
{
mouse.ChangeModeGraphic(eModeWalkto, 217);
}  

}
prevH = currentH;

}   


#164
Quote from: Crimson Wizard on Tue 06/07/2021 00:33:50
Quote from: Amir on Mon 05/07/2021 23:48:47
I want the selected inventory item to disappear after the interaction or dropping, both in the inventory with inventory items and outside with objects

When you say "dissapear" do you mean dissapear from cursor, or dissapear from player's inventory?

From cursor  ;-D
#165
Sorry for bothering again. I'm trying something but it dosn't work. I want the selected inventory item to disappear after the interaction or dropping, both in the inventory with inventory items and outside with objects.

I used if (DragDrop.EvtDragStarted) player.ActiveInventory = null; so that it's not chosen twice like in the video. This works fine.

in repeatedly execute
Code: ags

if ((DragDrop.EvtDragStarted) || (DragDrop.EvtDropped))
  {
    player.ActiveInventory = null;
  }


or alone

Code: ags

if (DragDrop.EvtDropped)
  {
   player.ActiveInventory = null;   
  } 


The inventory item doesn't go away.

#166
It's a good thing that I refreshed here and saw your edit. I almost wanted to try something complicated. Now it works  (laugh) ur right about hot != null, I have often read it here in the forum but forgot it. Such a little thing can cause disaster like a butterfly effect.

There are a few problems but it has nothing to do with the module. I think I can solve them on my own or I would create a new thread. the biggest problem would be the Android port but it doesn't matter if it doesn't work. Programming with AGS is fun.

Thank u so much for ur patience and help.
#167
QuoteDoes the code ever pass under "else if (inv != null)" ? You may test that either by placing a breakpoint there or "Display" command with some message.

Good question. I tried Display command, nothing happened, the Display message didn't appear.

QuoteYou are running eModeUseinv interaction. Do you have event of that type ("use inventory item on") created for your items?
What is inside these event functions, are there more conditions? Can you post an example of your script?

Yes, most of them have "use inventory item on" I tried many items with each other with an event and it happens the same as in the video. I'm not just trying money with carrot  ;-D
An example for useing an inventory item with another item: honey with bread.

Code: ags

function iBrot_UseInv()
{
if (cJesus.ActiveInventory == iHonig)
{
  aBrotmithonig.Play(eAudioPriorityNormal, eOnce);
  Wait(80);
  cJesus.LoseInventory(iBrot);
  cJesus.LoseInventory(iHonig);
  cJesus.AddInventory(iBrotmithonig);
  
}  
else
{
     int i;
    i = Random(3);
    if (i == 0) cJesus.Say("Das ist eine bizarre, teuflische Idee."); 
    if (i == 1) cJesus.Say("Wahrlich, wahrlich, ich sage dir: Das geht nicht.");
    if (i == 2) cJesus.Say("Versuche das nicht, sonst landest du in der Hölle.");
    if (i == 3) cJesus.Say("Du sollst den Herrn, deinen Gott nicht versuchen. Das geht doch nicht.");  
}  
}


I think it's up to the module. something is still missing something like player.ActiveInventory = DragDropCommon._InvItem; I read through ur module, tried to understand it, I got half of it but I couldn't find out why the inventory items don't interact with other inventory items.

#168
QuoteWrong interactions, as in wrong verb, or wrong inventory item?

Wrong verb.

But with player.ActiveInventory = DragDropCommon._InvItem; it works, cool  :)  inventory items still don't want to interact with other inventory items.

Code: ags

if (DragDrop.EvtWantDrop)
{
  cJesus.ActiveInventory = DragDropCommon._InvItem;
  
  if ((chara != null) || (obj != null) || (hot != null))
  {
   ProcessClick(mouse.x, mouse.y, eModeUseinv);
  }

  else if (inv != null) 
  {
    inv.RunInteraction(eModeUseinv);
  }
}


I made a video of whats happening. I've tried a lot of things but it still doesn't work. I think something is still missing in the code.


#169
Oh, sorry, I made a mistake when I was trying to design my post here. I edited it.

GUI.ProcessClick is new to me but it dosn't work, I tried inv.RunInteraction(eModeUseinv); before but I'm getting an error "Null pointer referenced"
I tried
Code: ags

  if ((chara != null) || (obj != null) || (hot != null) || (inv !=null))
  {
   //Room.ProcessClick(mouse.x, mouse.y, eModeUseinv);
   //inv.RunInteraction(eModeUseinv);
   //ProcessClick(mouse.x, mouse.y, eModeUseinv);
   //cJesus.RunInteraction(eModeUseinv);
   //GUI.ProcessClick(mouse.x, mouse.y, eModeUseinv);
  }


Room.ProcessClick, ProcessClick, cJesus.RunInteraction work but wrong interaction I mean, when I have if, else if and else, it ignores the commands in if and else if and prints the commands in else, I mean it only sees "els" and  inventory items still don't interact with other inventory items.  ???
#170
Quote
You write something similar in your "repeatedly_execute" function (e.g. in global script), and replace this with checking if there's a character, object, etc under the dragged item (or under the mouse x,y if you prefer), and if there's then, for example, call RunInteraction(eModeUseinv) for that object below.

Hi, I wrote something and I can now interact with hotspots,objects and characters but wrong interaction and inventory items don't interact with other inventory items. Do u know what's wrong?

Code: ags
function game_start() 
{ 

  DragDrop.Enabled = true;
  
  DragDropCommon.ModeEnabled[eDragDropInvItem] = true;
  DragDropCommon.DragMove = eDDCmnMoveGhostGUI;
  DragDropCommon.GhostGUI = gInvItemGhost;
  DragDropCommon.GhostTransparency = 0;
  DragDropCommon.GhostAlpha = false;
  DragDrop.DefaultHookKey = 0;
  DragDrop.DefaultHookMouseButton = eMouseLeft;
  DragDrop.DragMinDistance = 0;
  DragDrop.DragMinTime = 0;
  DragDrop.AutoTrackHookKey = true;
  DragDrop.DefaultUnhookAction = eDDUnhookRevert;
  }
  




Code: ags


function repeatedly_execute()
{
Character *chara = Character.GetAtScreenXY(mouse.x, mouse.y);
Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
Hotspot *hot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
InventoryItem *inv = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);

if (DragDrop.EvtWantDrop)
{
  if ((chara != null) || (obj != null) || (hot != null) || (inv !=null))
  {
   Room.ProcessClick(mouse.x, mouse.y, eModeUseinv);
  }
}
}



#171
Ahaaaa, I see.

I've tried something similar but not exactly as you described it. I will try it. Many Thanks.

QuoteI might need to add another room to this demo showing how to script this kind interaction

This is the best idea I ever heard  ;-D

QuoteI have a little game that uses this module too here: https://github.com/ericoporto/dungeonhands

I will check it out.

#172
@Crimson Wizard,  I checked room 4 script and created a gui like in ur module and I could drag the inventory items, but I couldn't let them interact with other inventory items, hotspots, objects and characters.

@eri0o  Oh, that's right. I'm trying to change a few things in my game so that it can be played on Android devices. All that remains is to drag the inventory items like other AGS games on Android, Whispers of a Machine, Blackwell series, etc.

if you are sure eri0o that this this module doesnt work on Android, is there some other code or method anywhere to do that?
#173
Can u drop and drag inventory items with the module and let them interact with other inventory items, hotspots, objects and characters?

I tried but I couldn't get it. Codes or modules for drop and drag of inventory items in other threads would also help although I couldn't find any.
#174
It works now. It's weird that it doesn't work from the SD card. Well, the main point it works. Thank u guys.
#175
Quote from: Crimson Wizard on Mon 28/06/2021 17:09:13
Quote from: Amir on Mon 24/02/1975 15:59:51quote author=Crimson Wizard link=topic=44768.msg636637433#msg636637433 date=1624896553]
Quote from: Amir on Mon 28/06/2021 16:58:31
I have Galaxy Tab A (2016) Android version 5.1.1, not 11 or 12  ;-D

I also have 5. something, and the latest 3.5.* ports work there (as well as the new 3.6.0 one which is currently in development stage). I don't have external card though so was using internal storage.
I have Galaxy Tab A (2016) Android version 5.1.1, not 11 or 12  ;-D

I also have 5. something, and the latest 3.5.* ports work there (as well as the new 3.6.0 one which is currently in development stage). I don't have external card though so was using internal storage.
[/quote]

Ahaaa so it must be because of SD card. Ok I'm going to delete a few things there and put the game there. Thank u.
#176
I have Galaxy Tab A (2016) Android version 5.1.1, not 11 or 12  ;-D

Unfortunately I have no idea about Android and the share interaction, I will not understand it like the other people. Anyway thank u for ur offer. I will try to put the game on the internal storage, maybe that's the solution, if that doesn't work I'll try older versions of android port. I will let you know.
#177
Quote from: Crimson Wizard on Mon 28/06/2021 13:03:14
@Amir, please clarify which version of the android port you are using.

Quote from: Amir on Mon 28/06/2021 09:28:20
I disabled MIDI sound in the game setup but Im still getting the error from MIDI sound  :undecided:

To double check, you need to set "midiid = none" or "0" in acsetup.cfg in the game folder.

Quote from: Amir on Mon 28/06/2021 09:28:20
which write permissions? and yes I have free space enough  :confused:

Where on the device did you put the game itself?


Oh I didn't know that, MIDI sound is now completely deactivate, no more error, thank u.

I'm using the latest version 3.5.1.8

I put it on my SD card, storage/extSdCard/ags . As JJS wrote the instructions "Games must be placed on the SD card root in the "ags" directory" 
I have 5 GB free space on my SD Card.

Should I put it on storage/emulated/0/ ? I have to delete some apps or games there, I have 723 MB free space.


#178
Hi, when I run my game I get 2 errors:

1-Warning: cannot enable MIDI audio. Problem: no compatible drives found in the system.
You may supress this message by disabling MIDI sound in the game setup.

2- Unable to write in the savegame directory. Make sure you have write permissions, and also check the disk's free space.

I disabled MIDI sound in the game setup but Im still getting the error from MIDI sound  :undecided:

which write permissions? and yes I have free space enough  :confused:

Does anyone know these errors and can help?
SMF spam blocked by CleanTalk