Exactly what I wanted!
Works great!
A super thanks to you Khris
Works great!
A super thanks to you Khris

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
bool IsItemInList(String[] itemList, String itemName)
{
for(int i=0; i< itemList.Length; i++)
{
if(itemList[i] == itemName)
return true;
}
return false;
}
import bool IsItemInList(String[] itemList, String itemName);
Quote from: morganw on Tue 11/12/2018 22:18:16
I imagine the goal of this is to pick 3 unique items from the array, so I thought I'd give it a try as there didn't seem to be an easy or obvious solution. Is there any better way than this, if the array values aren't used elsewhere?Code: ags String GetEditorExpectations(int count) { String interviewExpectations[]; interviewExpectations = new String[EXPECTATION_COUNT]; interviewExpectations[0] = "Aggressive"; interviewExpectations[1] = "Emotional"; interviewExpectations[2] = "Fictional"; interviewExpectations[3] = "Friendly"; interviewExpectations[4] = "Informative"; interviewExpectations[5] = "Interesting"; interviewExpectations[6] = "Intrusive"; interviewExpectations[7] = "Personally Viewed"; interviewExpectations[8] = "Tabloid"; interviewExpectations[9] = "Thrilling"; return ChoosePhrase(interviewExpectations, count, 1); }
bool interviewExpectations[10];
function InitEditorExpectations()
{
//init the array
for(int i=0; i < 10; i++)
{
interviewExpectations[i] = true;
}
}
String GetEditorExpectationsInTextFormat()
{
String expectations = "";
if(interviewExpectations[0] == true)
expectations = expectations.Append("Aggressive, ");
if(interviewExpectations[1] == true)
expectations = expectations.Append("Emotional, ");
if(interviewExpectations[2] == true)
expectations = expectations.Append("Fictional, ");
if(interviewExpectations[3] == true)
expectations = expectations.Append("Friendly, ");
if(interviewExpectations[4] == true)
expectations = expectations.Append("Informative, ");
if(interviewExpectations[5] == true)
expectations = expectations.Append("Interesting, ");
if(interviewExpectations[6] == true)
expectations = expectations.Append("Intrusive, ");
if(interviewExpectations[7] == true)
expectations = expectations.Append("Personally Viewed, ");
if(interviewExpectations[8] == true)
expectations = expectations.Append("Tabloid, ");
if(interviewExpectations[9] == true)
expectations = expectations.Append("Thrilling, ");
return expectations;
}
function SetEditorExpectations()
{
int rand = Random(9);
switch(rand)
{
case 0:
interviewExpectations[0] = true;
break;
case 1:
interviewExpectations[1] = true;
break;
case 2:
interviewExpectations[2] = true;
break;
case 3:
interviewExpectations[3] = true;
break;
case 4:
interviewExpectations[4] = true;
break;
case 5:
interviewExpectations[5] = true;
break;
case 6:
interviewExpectations[6] = true;
break;
case 7:
interviewExpectations[7] = true;
break;
case 8:
interviewExpectations[8] = true;
break;
case 9:
interviewExpectations[9] = true;
break;
}
}
function EMAILInteraction()
{
cEgo.ChangeRoom(67);
CurrentRoom = 67;
OutputBox.Visible = false;
BBCOutputBox.Visible = true;
BBCOutputBox.Text = "Electronic Messaging System:[1.Incoming[2.Outgoing(currently unavailable)";
if(editorHasSentExpectations)
{
InitEditorExpectations();
SetEditorExpectations();
SetEditorExpectations();
SetEditorExpectations();
}
}
if(TextBox1.Text == "1")
{
BBCOutputBox.Text = "Retrieving information...";
Wait(100);
if(editorHasSentExpectations)
{
String expectations = GetEditorExpectationsInTextFormat();
if(expectations.Length > 0)
{
BBCOutputBox.Text = String.Format("The story is expected to be:",expectations);
WriteToFile(expectations, "editor_Expectations.txt");
}
}
}
bool interviewExpectations[10];
function InitEditorExpectations()
{
//init the array
for(int i=0; i < 10; i++)
{
interviewExpectations[i] = true;
}
}
String GetEditorExpectationsInTextFormat()
{
String expectations = "";
if(interviewExpectations[0] == true)
expectations.Append("Aggressive, ");
if(interviewExpectations[1] == true)
expectations.Append("Emotional, ");
if(interviewExpectations[2] == true)
expectations.Append("Fictional, ");
if(interviewExpectations[3] == true)
expectations.Append("Friendly, ");
....
return expectations;
}
String expectations = "";
interviewExpectations[0] = true;
if(interviewExpectations[0] == true)
expectations = expectations.Append("Aggressive, ");
bool interviewExpectations[10];
function InitEditorExpectations()
{
//init the array
for(int i=0; i < 10; i++)
{
interviewExpectations[i] = true;
}
}
String GetEditorExpectationsInTextFormat()
{
String expectations = "";
if(interviewExpectations[0] == true)
expectations.Append("Aggressive, ");
if(interviewExpectations[1] == true)
expectations.Append("Emotional, ");
if(interviewExpectations[2] == true)
expectations.Append("Fictional, ");
if(interviewExpectations[3] == true)
expectations.Append("Friendly, ");
....
return expectations;
}
Quote from: tzachs on Sat 04/08/2018 04:47:24
In terms of best way to clear the inventory, the first question to ask is: are you sure you want to clear the inventory on EVERY inventory interaction? What most games do is clear the inventory after a meaningful interaction with this item when you no longer need it (because if a player wants to try an inventory item on a bunch of places in the room, it's annoying to reselect it every time).
If you don't need it on every interaction you can create a function with the 3 lines (clearing the inventory item and label) and call it from the use inv function (and every meaningful interaction).
If you do want to clear it every time, then one way of doing this would be to wait a frame before clearing the inventory item.
Try adding "Wait(1)" inside the if before clearing the inventory item.
else if (button == eMouseLeft) {
ProcessClick(mouse.x, mouse.y, mouse.Mode);
if(mouse.Mode == eModeUseinv)
{
player.ActiveInventory = null;
gActiveItemText.Visible = false;
activeItemText.Text = " ";
}
Quote
SetTextProperty (inventory)
bool InventoryItem.SetTextProperty(const string property, const string value)
Sets the new value text for the custom property for the specified inventory item. Returns TRUE if such property exists and FALSE on failure.
This command works with Text properties only. The property's text will be changed to new value.
Use the equivalent SetProperty function to set a non-text property.
Example:
iKey.SetTextProperty("Description", "A rusty key");
will change key's "description" property.
Compatibility: Supported by AGS 3.4.0 and later versions.
See Also: InventoryItem.SetProperty
iMoney.SetTextProperty("Description", final);
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.042 seconds with 16 queries.