Maniac Mansion Mania Forum
MMM-Werkzeugkiste => Technik => Thema gestartet von: 1mal_volltanken am 29. Februar 2012, 17:46:36
-
Hallo Leutz!
Entsprechend diesem Thread
http://www.maniac-mansion-mania.de/forum/index.php?topic=2077.0 (http://www.maniac-mansion-mania.de/forum/index.php?topic=2077.0)
benötige ich noch dringend technischen Beistand in Sachen Behebung folgender Probleme:
1.) Wie ändere ich das, dass der Speech immer mit Links-Oben(Top-Left)-Ausrichtung ausgegeben wird?
2.) Wie kann ich bei AGS 3.2.1 das Crossfade für Musik-Titel abschalten?
Danke schon mal im voraus.
BG
der Volltanker
-
Zu 1. habe ich nun folgendes ausprobiert (wie es KhrisMuc in einem Thread mal vorgestellt hat):
Im GlobalScript.asc:
void SayTop(this Character*, String message) {
int w = GetTextWidth(message, Game.SpeechFont) + 2;
this.SayAt(1, 1, w, message);
}
Und im Roomscript habe ich nun folgendes:
if (MovePlayer (90, 130)) {
FaceLocation (GetPlayerCharacter (), 90, 129);
Wait (5);
player.SayTop("Der funktioniert im Moment nicht.");
player.SayTop("Ich habe Doors XP installiert.");
}
Jetzt habe ich die Fehlermeldung:
Failed to save room room1.crm; details below
room1.asc(195): Error (line 195): '.SayTop' is not a public member of 'Character'. Are you sure you spelt it correctly (remember, capital letters are important)?
Wer weiss Rat?
BG
der Volltanker
-
Hast du die SayTop-Methode in der zugehörigen ash-Datei definiert? Muss man nämlich noch machen.
-
Muss ich da in der ash schreiben
import SayTop
?
Oder wie definiert man die?
BG
der Volltanker
-
Kopier die erste Zeile, dann setz "import" davor:
[ags]import void SayTop(this Character*, String message);[/ags]
-
So. Hab jetzt alles erledigt.
Zufrieden bin ich mit dem Ergebnis allerdings nicht, denn in Aktion sieht es folgendermaßen aus:
(http://www.bilder-upload.eu/thumb/046ac5-1330628761.png) (http://www.bilder-upload.eu/show.php?file=046ac5-1330628761.png)
Der Text wird hier weiterhin zentriert, anstatt das er linksbündig angezeigt wird. Außerden wird er auch nicht, wie man sieht, ganz nach oben an den Bildschirmkopf gesetzt.
Irgendetwas fehlt da noch, aber was?
Vielen Dank bisher und auch schon mal im voraus!
BG
der Volltanker
-
Nachdem ja eh schon eine Extenderfunktion benutzt wird, kann man die ja beliebig umschreiben.
Ich würde nicht SayAt verwenden, sondern ein Label, das kannst Du schön passend positionieren und linksbündig kann man es auch einstellen (geht allerdings auch mit gesprochenen Sätzen per game.speech_text_align).
void SayTop(this Character*, String message) {
int gameloops = ((message.Length / Game.TextReadingSpeed) + 1) * GetGameSpeed();
lblSpeech.TextColor = this.SpeechColor;
lblSpeech.Text = message;
WaitMouseKey(gameloops);
lblSpeech.Text = "";
}
Edit: Klammer eingefügt. Danke!
-
Danke!
Habs mal ausprobiert. Kam aber leider folgende Fehlermeldung heraus:
GlobalScript.asc(89): Error (line 89): Parse error in expr near '1'
BG
der Volltanker
-
In KhrisMUCs Code fehlt eine Klammer, und zwar in der Zeile
int gameloops = (message.Length / Game.TextReadingSpeed) + 1) * GetGameSpeed();
Füge noch eine Klammer vor 'message.Length' ein:
int gameloops = ((message.Length / Game.TextReadingSpeed) + 1) * GetGameSpeed();
-
Thx!
Danach kam schon der nächste Fehler gleich in der nächsten Zeile:
GlobalScript.asc(90): Error (line 90): Undefined token 'lblSpeech'
Diesen Fehler habe ich schon häufig gehabt, auch schon wo ich dieses C64-Script in MMM integrieren wollte.
Ist das auch wieder ein fehlender "import"?
Danke bis dahin schon mal.
BG
der Volltanker
-
Ein bisschen Mitdenken hätte ich schon erwartet...
Wie ich schrieb, brauchst Du ein GUI und Label. Ich vermute mal, dass der schwarze Rand bereits ein GUI ist, also öffne dieses und setz ein Label drauf. Setz es an Position 1,1 oder so und mach es zwei Zeilen hoch und so breit wie den Bildschirm (ca. 318x24).
Dann nennst Du es - Trommelwirbel - lblSpeech!
-
Jo! Thx!
Mit dem Label hat das jetzt schon geklappt.
Allerdings läuft die Speech-Animation noch nicht mit.
Ich habe mal das Script durchforstet, wo die Speech-Animation erwähnt zu sein schien, und zwar in den Functions "DisplaySpeechBackgroundEx" und "DisplaySpeechQ_RE()" aber so ganz durchgestiegen bin ich da nicht.
Was fehlt denn noch in dem Script, dass die Speech-Animation startet?
Zum anderen ist der Font3 (also der C64-Font), der schon ursprünglich im Starterpak mit integriert war, zu groß für den lblSpeech, so dass die zweite Zeile nur noch teilweise sichtbar ist.
Der Font ist einst ja mit einer Größe von 10pt importiert worden. Kann ich trotzdem noch diese Fontgröße anpassen? Normal dürfte das ja nur eine Zeile sein, nur fand ich keinen Befehl heraus, der in etwa "eFontFont3.SetFontHeight(8);" oder so in der Art zur Verfügung stand.
Danke schon mal für die bisherige Hilfe! Super!
BG
der Volltanker
-
AGS kann Fonts nicht selbst skalieren, Du müsstest eine kleinere verwenden.
Die Say-Animation musst Du auch von Hand starten.
Man könnte auch tricksen, eine unsichtbare Schrift verwenden und den Charakter tatsächlich sprechen lassen.
Entweder nimmt man eine Schrift, in der man vorher alle Zeichen gelöscht hat, oder man setzt die Farbe auf "magic pink", falls das funktioniert. Und natürlich ohne Outline.
SayAt außerhalb der Screens geht vermutlich nicht.
[ags]void SayTop(this Character*, String message) {
lblSpeech.TextColor = this.SpeechColor;
lblSpeech.Text = message;
this.Say(message);
lblSpeech.Text = "";
}[/ags]
-
Hmm.
Gibt es da auch ne abgekürzte Version in der Art von
AnimateCharacter(this Character*.Speechview) ?
Magic.Pink einzustellen könnte sich schwierig gestalten.
Beim Ausprobieren ist mir jetzt auch aufgefallen, dass die Gameloops von Say und SayTop unterschiedlich lang sind, so dass die Funktion SayTop noch kurz nachläuft, nachdem die Funktion Say schon beendet ist.
Die Möglichkeit einen leeren Font einzubauen, wäre vielleicht gar nicht so schlecht. Leider ist das Script bei den Starterpaks dermaßen komplex aufgebaut, dass sich das direkt übern Editor gar nicht anpassen lässt. Beim Probieren meine ich, festgestellt zu haben, dass für den Speech und für die Actionbar der gleiche Font genutzt wird, sprich also, der gleiche Verweis im Script. Man findet ja bspw. diese Fontliste im Script:
[ags] // --- load font corresponding to language and screen width ---
string font_info;
if (system.screen_width == 320) StrCopy (font_info, GetTranslation ("font_320: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"));
else if (system.screen_width == 640) StrCopy (font_info, GetTranslation ("font_640: 13 14 14 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 14"));
clearToSpace (font_info);
SetSpeechFont (getInteger (font_info)); // Speech
SetLabelFont (0, 0, getInteger (font_info)); // Status-Line[/ags]
Ich habe da in der ersten Zeile alle Fonts auf 3 geändert (weil das ja eh der C64-Font ist), wofür jede Position steht, ist leider gar nicht mehr ersichtlich.
BG
der Volltanker
-
Hallo,
ich versuche gerade das Script zu integrieren, dass der Kanadier aus dem AGS-Forum für mich erstellt hatte. Da haut das tatsächlich auch exakt so hin.
Allerdings muss ich es leicht umschreiben und dem MMM-Script anpassen: Bis jetzt bin ich soweit gekommen:
[ags]function Reset_Line()
{
mouse.Mode = eModeWalkto;
UsedAction == A_WALK_TO;
gAction.Text = "Walk to";
UsedAction = A_WALK_TO;
}
void SayTop(this Character*, String message) {
int gameloops = ((message.Length / Game.TextReadingSpeed)) * GetGameSpeed();
lblSpeech.TextColor = this.SpeechColor;
lblSpeech.Text = message;
this.Say(message);
WaitMouseKey(gameloops);
lblSpeech.Text = "";
}
function Talk(this Character*, String message)
{
lblSpeech.TextColor = this.SpeechColor;
lblSpeech.Text = message;
int tempo = this.View;
this.StopMoving(); // just to be sure
int Cmpt =0;
String Empty = " ";
while (Cmpt < message.Length)
{
Empty = String.Format("%s ",Empty);
Cmpt++;
}
this.Say(Empty);
lblSpeech.Text = "";
Reset_Line();
} [/ags]
Unter der Function "Reset_Line" gibt er mir einen Klammerfehler aus. Ich hab auch alles mit einfach Klammer und auch doppelt eingeklammert ausprobiert. Bekomme da aber leider die Fehlermeldung nicht weg.
BG
der Volltanker
-
[ags] // --- load font corresponding to language and screen width ---
string font_info;
if (system.screen_width == 320) StrCopy (font_info, GetTranslation ("font_320: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"));
else if (system.screen_width == 640) StrCopy (font_info, GetTranslation ("font_640: 13 14 14 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 14"));
clearToSpace (font_info);
SetSpeechFont (getInteger (font_info)); // Speech
SetLabelFont (0, 0, getInteger (font_info)); // Status-Line[/ags]
Das hat jetzt nichts mit deinem konkreten Problem zu tun, sondern mit einem Bug in deinem Codebeispiel der sich schon wieder von SP zu SP zieht.
Das Ganze ist ein Kampf gegen Windmühlen und ärgert mich ehrlich gesagt schon ein bischen.
Hat jetzt nichts mit dir zu tun, aber ich hab mir grade das Bernard SP 3_2 angesehen und da ist er auch wieder drinnen.
Mit obigen Code funktionieren die Games auf Wide-Screen Monitoren (die mittlerweile fast jeder verwendet, behaupte ich mal) nicht im Vollbildmodus.
Weil bei einem 16:9 oder 16:10 Monitor AGS automatisch die Breite anpasst.
Das heisst aus 320 werden automatisch dann 360, obige Anweisung wird nicht mehr durchgeführt font_info ist nicht definiert und das Game läuft nicht, daher bitte diese 2 Zeilen Code ersetzen:
[ags]
font_info = GetTranslation ("font_320: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0");
if (System.ViewportWidth >= 640) font_info = GetTranslation ("font_640: 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4");
[/ags]
Es gehört jedenfalls ein Thread her, der alle Bugs die mittlerweile schon x-mal aufgetreten sind, dann vereinzelt gefixt wurden,
nur um in der nächsten Version des SPs wieder aufzutauchen, zusammengefasst werden, damit jeder der ein SP erstellt sich daran halten kann und diese Bugs gleich ausmerzt.
-
Ich glaube, dass es diese Unterscheidung sowieso nicht mehr braucht.
Neuere Versionen der Engine lassen eine native Auflösung von 640 für 320er Spiele eh nicht mehr zu.
Man kann ja problemlos mit dem x2 Filter hochskalieren, falls 320 nicht mit Vollbild läuft.
Sprich, die Verwendung von anderen Schriftarten ist nicht mehr notwendig, was den ganzen Mechanismus ebenfalls überflüssig macht.
1mal_volltanken:
Schau Dir mal diesen Bereich an:
[ags] UsedAction == A_WALK_TO;
gAction.Text = "Walk to";
UsedAction = A_WALK_TO;[/ags]
Da wird versucht, die Funktion UsedAction() auf A_WALK_TO zu setzen, und zwar mittels dem Vergleichsoperator "==", dann nochmal mit "=".
Von wem stammt dieser Code...??
Warum muss überhaupt die Verb-Zeile manuell nach jeder Dialog-Zeile zurückgesetzt werden...?
Und ich bin ja mal gespannt, ob (Anzahl Zeichen mal 3) Leerzeichen sagen genauso lang dauert, wie den ursprünglichen Text.
-
Hallo.
Also das ursprüngliche Script zu dem Speech sah genau so aus:
[ags]function Reset_Line()
{
mouse.Mode = eModeWalkto;
Action_Verb = "Walk to";
LblAction.Text = "Walk to";
Action = aWalkTo;
}
function Black()
{
gMainGui.Visible = false;
mouse.Visible = false;
LblAction.Visible = false;
LBL_MESSAGE_TOP.Text = ""; // black will always erase this one.
}
function Back()
{
gMainGui.Visible = true;
mouse.Visible = true;
LblAction.Visible = true;
}
function Talk(this Character*, String What)
{
LBL_MESSAGE_TOP.TextColor = this.SpeechColor;
LBL_MESSAGE_TOP.Text = What;
int tempo = this.View;
this.StopMoving(); // just to be sure
int Cmpt =0;
String Empty = " ";
while (Cmpt < What.Length)
{
Empty = String.Format("%s ",Empty);
Cmpt++;
}
this.Say(Empty);
LBL_MESSAGE_TOP.Text = "";
Reset_Line();
} [/ags]
Ich hatte das nur entsprechend versucht umzuschreiben und das mit = und == ist eher ein Syntax-Fehler von mir gewesen. Aber ich kann ja mal versuchen, es einfach wegzulassen und schauen, ob das jetzt Auswirkungen hat. Wollte das nur eben 1:1 beibehalten nur halt mit den Script-Codes von MMM.
BG
der Volltanker
-
Jaaaa-haaaa-hiiii Hi-ha-ha-haaaaaaaaa !!!
Es funktioniiiiiieeeeert! Es funtioniiieeeert !!!
Ich habe einfach nur den Inhalt der 'Reset-Line'-function geleert und es funktioniiiieeert! ;D ;D ;D INKLUSIVE Speech-Animation!
Nur noch eine kleine Sache, die mich stört. Durch nen Screenshot habe ich die Fontgröße mal nachgemessen und die ist korrekt. Auf 2xFilter ist jeder Großbuchstabe 12x14 px groß, was in der Standart-Auflösung ebenfalls korrekt ist. Also an der Größe lag es nicht.
Das Problem ist nur der Zeilenabstand !!! Siehe Bild:
(http://www.bilder-upload.eu/thumb/5f5309-1331557182.png) (http://www.bilder-upload.eu/show.php?file=5f5309-1331557182.png)
Gibt es eine Möglichkeit den Zeilenabstand des Fonts zu verändern?
Das wär natürlich klasse, ansonsten muss man für den Speech mit einer Zeile hinkommen. Im Original MM auf C64, war das ja auch so. Da waren die Screens auch 136 px hoch anstatt 128.
@Rocco:
Ich hab Dein Script einmal eingefügt, aber da gabs ne Fehlermeldung. Deswegen hatte ich es wieder zurückgesetzt. Vielleicht das Script lieber noch einmal überprüfen.
Bis dahin erstmal. Ich melde mich wahrscheinlich bald wieder. ;)
BG
der Volltanker
-
Das müsste wiederum per FontEdit gehen. Dort kann man die Höhe der Zeichen einstellen, auch für alle auf einmal, soweit ich weiß.
Die andere Möglichkeit wäre, einfach das schwarze GUI ein paar Pixel höher zu machen...
-
Ne. Editieren lässt sich das leider nicht. Mir ist da nun ein anderer Einfall gekommen, und zwar 2 Labels zu verwenden (für jede Zeile also ein eigenes).
Das heisst, wenn der Speech über 2 Zeilen geht, laufen dafür dann 2 Speeches zeitgleich. Damit kann ich das 2.Label so anpassen, dass in der Höhe die Buchstaben nur noch einen Abstand von 1 px haben.
Im Einsatz soll das dann in etwa so aussehen (P.S.: Der Befehl heisst jetzt 'Talk'):
[ags]player.Talk("Wir beide haben schon eine Menge Adventures");
player.Talk2("erlebt");
[/ags]
Das wär so ein Beispiel von einem Speech, der über 2 Zeilen geht. Entscheident ist hier natürlich, dass beide Speeches syncron ablaufen und nicht hintereinander.
Das macht man bestimmt auch mit einem 'while'-Befehl oder? Wie es technisch als function programmiert aussieht, kann ich nur erahnen, aber nicht wirklich wiedergeben. Außerdem muss ich, schätz ich mal, die Zeitdauer om Speech, manuell einstellen, wenn ich 2 Zeilen verwende, da diese Zeiteinheit laut Script abhängig von der Länge des Textes ist und das könnte bedeuten, dass die eine Zeile zeitlich vor der anderen verschwindet.
Wie könnte das Script denn in etwa Aussehen?
BG
der Volltanker
-
Ich habe da mal als erstes eine neue Klasse erstellt "C64.asc". Darein dann folgendes:
[ags]void Talk(this Character*, String message) {
this.StopMoving(); // just to be sure
while(message.Length > 0) {
int Cmpt = 0;
String Empty = " ";
while (Cmpt < message.Length)
{
Empty = Empty.AppendChar(' ');
Cmpt++;
}
String message1 = "", message2 = "";
while(message.Length > 0 && !message.StartsWith("\n") && GetTextWidth(message1.Append(message.Substring(0, 1)), lblSpeech1.Font) < lblSpeech1.Width) {
message1 = message1.Append(message.Substring(0, 1));
message = message.Substring(1, message.Length - 1);
}
if(message.StartsWith("\n")) {
message = message.Substring(1, message.Length - 1);
}
lblSpeech1.TextColor = this.SpeechColor;
lblSpeech1.Text = message1;
while(message.Length > 0 && !message.StartsWith("\n") && GetTextWidth(message2.Append(message.Substring(0, 1)), lblSpeech1.Font) < lblSpeech2.Width) {
message2 = message2.Append(message.Substring(0, 1));
message = message.Substring(1, message.Length - 1);
}
if(message.StartsWith("\n")) {
message = message.Substring(1, message.Length - 1);
}
lblSpeech2.TextColor = this.SpeechColor;
lblSpeech2.Text = message2;
this.Say(Empty);
lblSpeech1.Text = "";
lblSpeech2.Text = "";
}
}[/ags]
Dann noch in die C64.ash:
[ags]import void Talk(this Character*, String message);[/ags]
Im GUI Border dann folgende Controls angelegt:
lblSpeech1, Font: 3, Height: 9, Width: 320, Left: 0, Top: -2
lblSpeech2, Font: 3, Height: 9, Width: 320, Left: 0, Top: 6
und zu guter letzt im Raumskript:
[ags]player.Talk("Meine Arbeit für Jugend forscht.\nEs hört einfach nicht auf, sich zu drehen.");[/ags]
Sieht dann so aus:
(http://data.e7p.de/AGS_Talk.png)
Diese Version bricht dann natürlich nur nach manuellen Zeilenumbrüchen ("\n") und ansonsten auch mitten im Wort um, mit ein bisschen mehr Aufwand ließe sich das ganze dann noch auf Umbrüche nach einzelnen Worten umrüsten.
Ich frage mich nur wie man das dann am besten in Dialogen macht. An sich sollten in Dialogskripten dann ja die selben Befehle genügen, nur weiß ich nicht ob man das generell nicht noch eleganter lösen könnte.
-
Super.
Klar, wenn man das Functionsscript einmal programmiert hat, denke ich, wird es sicher nicht das größte Problem sein ein /n am Zeilenumbruch einzufügen.
Im Alpha-Test sieht man dann ja, wo der Zeilenumbruch stattfinden muss und kann das entsprechend auch einfügen. ;)
Klasse. Ich versuch das mal. Nur heute schaffe ich das nicht mehr, ansonsten "Daumen hoch". So langsam aber sicher, kommen wir dem Ziel dort immer näher.
BG
der Volltanker
-
@Rocco:
Ich hab Dein Script einmal eingefügt, aber da gabs ne Fehlermeldung. Deswegen hatte ich es wieder zurückgesetzt. Vielleicht das Script lieber noch einmal überprüfen.
änder einfach diese 2 Zeilen
[ags]
if (system.screen_width == 320) StrCopy (font_info, GetTranslation ("font_320: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"));
else if (system.screen_width == 640) StrCopy (font_info, GetTranslation ("font_640: 13 14 14 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 14"));[/ags]
auf diese hier um:
[ags]
StrCopy (font_info, GetTranslation ("font_320: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"));
if (System.ViewportWidth >= 640) StrCopy (font_info, GetTranslation ("font_640: 13 14 14 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 14"));[/ags]
-
Hallo.
Ich wollte mal wissen, wie ich das scripten kann, dass bei der ActionBar beim drüberfahren mit der Maus die Textfarbe in die HighlightColor wechselt und auch wieder in die NormalColor wechselt wenn man den Mauszeiger wieder von der ActionBar entfernt.
Zum anderen möchte ich, dass beim Pausieren wie auf dem C64 der MouseCursor in dem Wait-Modus wechselt.
Ich habe schon im "if (GameIsPaused)"-Script schon den Befehl "SetCursorMode(eModeWait);" eingesetzt, aber der Cursor ging erst in den Wait-Modus, NACHDEM ich das 2.Mal Leertaste gedrückt habe um den Pause-Modus auszuschalten.
Danke schon mal im voraus.
BG
der Volltanker
-
Du müsstest in on_key_press diesen Block haben:
[ags] if (keycode == 32)
{
// SPACEBAR
if (IsGamePaused () == 0)
{
GUIOn (PAUSED);
DisableInterface ();
}
else
{
GUIOff (PAUSED);
EnableInterface ();
}
}[/ags]
Dort rein muss auch die Zeile zum Verändern des Cursors. Wohin genau solltest Du selber erkennen :)
Zu der anderen Frage:
[ags]// in UpdateActionBar() letzte Zeile ersetzen durch:
Button*b = gAktiontext;
GUIControl*gc = GuiControl.GetAtScreenXY(mouse.x, mouse.y);
if (gc != null && gc.AsButton == b) b.TextColor = ActionLabelColorHighlight;
else b.TextColor = ActionLabelColorNormal;[/ags]
Eventuell heißen in deinem Pack die Variablen für die Farben anders, und wahrscheinlich hat das Label keinen Skriptnamen.
Falls nicht, öffne das Action-GUI, klick auf das Label und gib ihm den Namen "gAktiontext".
Die Variablen für die Textfarben müssten ganz am Anfang des Global scripts definiert sein (Zeile 40/41).
-
Ich habe den SetCursorMode direkt unter die Zeile DisableInterface (); gesetzt, also innerhalb der ersten Funktionsklammern. Erschien mir dort auch logisch und da passierte ja genau das, was ich beschrieben hatte.
Das andere probiere ich auch mal aus.
Danke schon mal.
BG
der Volltanker
-
Ich habe es mal folgendermaßen eingebaut:
[ags]function UpdateActionBar (){
// set the text in the action bar
string madetext;
int action = global_action;
string objekt;
string item;
StrCopy (objekt, SHOWNlocation);
StrCopy (item, "");
if (GlobalCondition (5) == 1)
{
// write SWITCH TO CHAR
action = A_SWITCH_TO;
if (GetGUIObjectAt (mouse.x, mouse.y) == 12)
{
StrCopy (objekt, character [GSotherplayerup].name);
}
else
{
StrCopy (objekt, character [GSotherplayerdown].name);
}
}
else if (GetCursorMode () == 4)
{
// use or give inventory item
GetInvName (character [GetPlayerCharacter ()].activeinv, item);
RemoveExtension (item);
}
else if (GlobalCondition (1) == 1)
{
// if the mouse is in the inventory and modes Walk or pickup are selected
action = A_USE;
}
TranslateAction (madetext, action, objekt, item);
// show action text
SetLabelText (ACTION, 0, madetext);
Button*b = gAction;
GUIControl*gc = GuiControl.GetAtScreenXY(mouse.x, mouse.y);
if (gc != null && gc.AsButton == b) b.TextColor = ActionLabelColorHighlight;
else b.TextColor = ActionLabelColorNormal;[/ags]
Leider kam dort die Fehlermeldung Type mismatch:"cannot convert GUI".
BG
der Volltanker
-
Sorry, es muss natürlich Label heißen, nicht Button.
Trotzdem muss auch der Name des Labels nach dem ersten "=" stehen, nicht das GUI.
So sollte es klappen:
[ags] Label*lbl = gAction.Controls[0].AsLabel;
GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (gc != null && gc.AsLabel == lbl) lbl.TextColor = ActionLabelColorHighlight;
else lbl.TextColor = ActionLabelColorNormal;[/ags]
-
Hallo.
Bekomme auf der 2.Zeile Deines Scripts folgende Fehlermeldung:
GlobalScript.asc(480): Error (line 480): undefined symbol 'GuiControl'
BG
der Volltanker
-
Es muss GUIControl heißen, habs auch in meinem letzten Post korrigiert.
-
So, jetzt sind die Fehlermeldungen aufgehoben. ;)
Nur leider wechselt die Actionbar immer noch nicht in die Highlighted-Color. Warum auch immer.
BG
der Volltanker
-
Keine Ahnung, was da los ist. Ist halt saubled (sehr ungünstig), dass Du ein uraltes Pack in 3.2 geholt hast.
Schau doch mal nach, welche ID das Label mit dem Aktionstext hat. Öffne das GUI "gAction", klick den Text an und überprüf die Nummer im Dropdown-Menü über den Eigenschaften.
Wenn das keine 0 ist, dann ersetz in meinem Code die 0 in der ersten Zeile durch die entsprechende Zahl.
-
Hab die Probleme jetzt endlich lösen können.
1) Der Pause-Teil muss so aussehen:
[ags] if (IsGamePaused () == 0)
{
GUIOn (PAUSED);
DisableInterface ();
mouse.ChangeModeView(9, -1);
}
else
{
GUIOff (PAUSED);
EnableInterface ();
mouse.ChangeModeView(9, 100);
}[/ags]
Da das Pack einen animierten Cursor verwendet, wird das statische Image ignoriert. Ein Ändern allein nützt deswegen nichts, es muss auch die View abgeschaltet werden. Zusätzlich zu diesem Code musst Du nur die 26 als Image von eModeUsermode2 eintragen.
Der Code zum "highlighten" der Aktionszeile hat nicht funktioniert, weil das Verben GUI im Vordergrund war. Setz die z-Order von gAction auf 30 und gPaused auf 40, dann müsste es passen.
-
Jau.
Das mit dem Pause-Teil funktioniert jetzt einwandfrei. Danke.
Das mit dem Highlighted jetzt auch, allerdings auf Kosten dessen, dass sich die Verben im GUI bei Klick nicht mehr aktivieren lassen. Das ist doch echt zum Mäuse melken! :P
BG
der Volltanker
-
Sorry, stimmt, Du musst bei Usermode2 noch HotspotX auf 12 und HotspotY auf 11 setzen, außerdem beim GUI gAction die Höhe auf 10.
-
Joooouuuuu! Goooooiiiiieeeelllll!
Es funktioniiiiiiieeeert! :) Jetzt endlich ist es soweit! ;)
Besten Dank!
BG
der Volltanker
-
Hallo.
Ich überlege mir ernsthaft, mich noch einmal daran heranzuwagen, ein 15-Verben-GUI zu basteln.
Zuerst wollt ich mir aber eine klare Vorgehensweise zurechtlegen, um sicher zu gehen, dass ich mit möglichst wenig Komplikationen ans Ziel komme.
Meine erste Idee der Vorgehensweise sieht folgendermaßen aus:
Ich wollte das alte MainGUI unbearbeitet lassen und stattdessen ein neues GUI daneben erstellen, bspw. 15VerbsMainGUI. Wäre das überhaupt der optimale Weg oder wäre die Gefahr, dass sich stetig Fehlermeldungen einschleichen, dabei deutlich größer?
Kurz und knapp: Ist es besser das alte GUI zu bearbeiten oder ein neues GUI zu erstellen?
Zumindest könnte ich befürchten, dass es oft Fehlermeldungen bezüglich des Inventory-GUIs geben könnte, denn im neuen GUI würden die Items nur noch als Text zu sehen sein und zum anderen würden da auch anstelle von 8 Inventory-Plätze nur noch 4 verbleiben. Anders als bei den Verben bestehen die Inventory-Items tatsächlich auch im technischen Sinne nur aus Text.
Auch den berühmten "New Kid"-Button möchte ich wieder einführen. Technisch habe ich es mir so gedacht, dass ich ähnlich wie bei der ActionBar ein 1-Zeilen-GUI mache, bspw. NewKidGUI, dass sich nach dem Anklicken des Buttons über die ActionBar lappt und dieser mit 3 Buttons "PlayerID1", "PlayerID2" und "PlayerID3" ausgestattet wird.
Zur allgemeinen Veranschaulichung möchte ich hier noch einmal die Scripts zeigen, die mir der Kanadier aus dem AGS-Forum geschickt hat:
Global.ash
[ags]// Main header script - this will be included into every script in
// the game (local and global). Do not place functions here; rather,
// place import definitions and #define names here to be used by all
// scripts.
// +++ The following are not necessary but Cool functions +++
import function Black();
import function Back();
import function UHE();
import function FaceNorth(this Character*);
import function FaceSouth(this Character*);
import function FaceWest(this Character*);
import function FaceEast(this Character*);
import function Talk(this Character*, String What);
// +++ The followings is made to simplify lives +++++++++++++
enum ACTION
{
aPush, aPull, aGive,
aOpen, aClose, aUse,
aWalkTo, aPickUp, aLookAt,
aTalkTo, aTurnOn, aTurnOff,
};[/ags]
Global.asc
[ags]// main global script file
function APPLY_CUSTOM()
{
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// XXXXXX XX XX XXXXXX XXXXXXXX XXXXXXX XXX XXX
// XX XX XX XX XX XX XX XX XX XX XX
// XX XX XX XXXXXX XX XX XX XX X XX
// XX XX XX XX XX XX XX XX XX
// XXXXXX XXXXXXX XXXXXX XX XXXXXXX XX XX
//
//
// XXXXXX XXXXXXXX XXX XX XXXXXX XXXXXX (TM)
// XX XX XX XX XX XX
// XXXXXX XX XX XX XXXX XXXX
// XX XX XX XX XX XX
// XXXXXX XX XXXXXXX XX XX
//
//
//----------------------------------------------
// Set the player Here using their SCRIPT names
//----------------------------------------------
PLAYER_1ID = cSyd;
PLAYER_2ID = cHoagie;
PLAYER_3ID = cRazor;
//----------------------------------------------
//
//
//----------------------------------------------
// Choose the colors of Things
//----------------------------------------------
COLOR_ACT_LINE_NORMAL = C64COLOR_PINK;
COLOR_ACT_LINE_MOUSEOVER = C64COLOR_YELLOW;
COLOR_INV_NORMAL = C64COLOR_PINK;
COLOR_INV_MOUSEOVER = C64COLOR_YELLOW;
COLOR_CHANGE_P_NORMAL = C64COLOR_PBLUE;
COLOR_CHANGE_P_MOUSEOVER = C64COLOR_YELLOW;
//----------------------------------------------
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function Reset_Line()
{
mouse.Mode = eModeWalkto;
Action_Verb = "Walk to";
LblAction.Text = "Walk to";
Action = aWalkTo;
}
function Black()
{
gMainGui.Visible = false;
mouse.Visible = false;
LblAction.Visible = false;
LBL_MESSAGE_TOP.Text = ""; // black will always erase this one.
}
function Back()
{
gMainGui.Visible = true;
mouse.Visible = true;
LblAction.Visible = true;
}
function Talk(this Character*, String What)
{
LBL_MESSAGE_TOP.TextColor = this.SpeechColor;
LBL_MESSAGE_TOP.Text = What;
int tempo = this.View;
this.StopMoving(); // just to be sure
int Cmpt =0;
String Empty = " ";
while (Cmpt < What.Length)
{
Empty = String.Format("%s ",Empty);
Cmpt++;
}
this.Say(Empty);
LBL_MESSAGE_TOP.Text = "";
Reset_Line();
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function FaceNorth(this Character*) {this.FaceLocation(this.x, 0, eBlock);}
function FaceSouth(this Character*) {this.FaceLocation(this.x, 300, eBlock);}
function FaceWest(this Character*) {this.FaceLocation(0,this.y, eBlock);}
function FaceEast(this Character*) {this.FaceLocation(1000, this.y, eBlock);}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function UPDATE_ACTION()
{
LblAction.Text = Action_Verb;
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function New_Player(Character* WhoSNext)
{
Black();
// +++ Visual Show again Character ++++++++++++++++
bChangeP1.Visible = true; lChangeP1.Visible = true;
bChangeP2.Visible = true; lChangeP2.Visible = true;
bChangeP3.Visible = true; lChangeP3.Visible = true;
// ++++++++++++++++++++++++++++++++++++++++++++++++
// +++ Erase the next player button +++++++++++++++
if (lChangeP1.Text == WhoSNext.Name){bChangeP1.Visible = false; lChangeP1.Visible = false;}
if (lChangeP2.Text == WhoSNext.Name){bChangeP2.Visible = false; lChangeP2.Visible = false;}
if (lChangeP3.Text == WhoSNext.Name){bChangeP3.Visible = false; lChangeP3.Visible = false;}
// ++++++++++++++++++++++++++++++++++++++++++++++++
if (player.Room == WhoSNext.Room)
{
if (Room.Width > 320){// transitional room so scroll
int Cmpt = GetViewportX();
int Dest = WhoSNext.x;
if (player.x > Dest) { // SCROLL RIGHT
while(Cmpt > Dest-160)
{
SetViewport(Cmpt, GetViewportY());
Cmpt=Cmpt-4;
Wait(1);
}
}
else { // SCROLL LEFT
while(Cmpt < Dest-160)
{
SetViewport(Cmpt, GetViewportY());
Cmpt=Cmpt+4;
Wait(1);
}
}
}
ReleaseViewport();
}
WhoSNext.SetAsPlayer();
Back();
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// A function that initializes a bunch of stuff.
function initialize_control_panel() {
// Centre the control panel
gPanel.Centre();
// Centre the Restart dialog as well
gRestartYN.Centre();
if (!IsSpeechVoxAvailable()) {
// If there is no speech-vox file, and therefore no speech,
// disable all the controls related with speech.
lblVoice.Visible = false;
btnVoice.Visible = false;
sldVoice.Visible = false;
}
else {
// If there *is*, then set it to voice and text. It's best to use
// both whenever possible, for the player's sake.
SetVoiceMode(eSpeechVoiceAndText);
// And reflect this in the control panel.
btnVoice.Text = "Voice and Text";
}
if (!System.SupportsGammaControl) {
// If we can't change the gamma settings, disable the relevant options.
sldGamma.Visible = false;
lblGamma.Visible = false;
}
//And now, set all the defaults
SetMusicMasterVolume(100);
sldMusic.Value = 200;
sldSound.Value = 200;
SetSoundVolume(200);
SetGameSpeed(40);
sldSpeed.Value = 40;
if (IsSpeechVoxAvailable()) {
SetVoiceMode(eSpeechVoiceAndText);
btnVoice.Text = "Voice and Text";
sldVoice.Value = 255;
SetSpeechVolume(255);
}
if (System.SupportsGammaControl) {
System.Gamma = 100;
sldGamma.Value = 100;
}
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Called when the game starts, before the first room is loaded
function game_start() {
initialize_control_panel();
APPLY_CUSTOM();
// ++++ STEP 1 - JUST BEING SURE The verbs buttons are on the same ROW ++++
bOpen.Y = bPush.Y; bWalkTo.Y = bPush.Y; bTalkTo.Y = bPush.Y; bChangeP1.Y = bPush.Y; // Row1
bClose.Y = bPull.Y; bPickUp.Y = bPull.Y; bTurnOn.Y = bPull.Y; bChangeP2.Y = bPull.Y; // Row2
bUse.Y = bGive.Y; bLookAt.Y = bUse.Y; bTurnOff.Y = bGive.Y; bChangeP3.Y = bGive.Y; // Row3
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++ STEP 2 - JUST BEING SURE The verbs buttons are on the same Columns ++++
bPull.X = bPush.X; bGive.X = bPush.X; //Column1
bClose.X = bOpen.X; bUse.X = bOpen.X; //Column2
bPickUp.X = bWalkTo.X; bLookAt.X = bWalkTo.X; //Column3
bTurnOn.X = bTalkTo.X; bTurnOff.X = bTalkTo.X; //Column4
bChangeP2.X = bChangeP1.X; bChangeP3.X = bChangeP1.X; //Column5
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++ STEP 3 - JUST BEING SURE EVERYTHING IS ALIGN ON THE WORD INV ++++
cinvent1hg.Y = bGive.Y+bGive.Height+3;
cinvent2hd.Y = cinvent1hg.Y; // Hidden top-Right Button
cinvent3bg.Y = cinvent1hg.Y+cinvent1hg.Height;
cinvent4bd.Y = cinvent3bg.Y; // Hidden Bottom-Right Button
linv1hg.SetPosition(cinvent1hg.X, cinvent1hg.Y); // Top-left Label over Top-left Hidden Button
linv2hd.SetPosition(cinvent2hd.X, cinvent2hd.Y); // Top-right Label over Top-right Hidden Button
linv3bg.SetPosition(cinvent3bg.X, cinvent3bg.Y); // Bottom-left Label over Bottom-left Hidden Button
linv4bd.SetPosition(cinvent4bd.X, cinvent4bd.Y); // Bottom-right Label over Bottom-right Hidden Button
btnInvU2.Y = cinvent1hg.Y;
bINV_Down.Y = cinvent3bg.Y;
bINV_Down.X = btnInvU2.X;
bChangeP2.X = bChangeP1.X; bChangeP3.X = bChangeP3.X;
lChangeP1.SetPosition(bChangeP1.X, bChangeP1.Y);
lChangeP2.SetPosition(bChangeP2.X, bChangeP2.Y);
lChangeP3.SetPosition(bChangeP3.X, bChangeP3.Y);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++ STEP 3 - BECAUSE USUALLY PPL STARTS WITH NO INV ++++++++++++++++++++
// (DON'T PANIC - If it's not the case it will be reajusted automatically)
btnInvU2.Visible = false;
bINV_Down.Visible = false;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++ STEP 4 - TO MAKE EVERYTHING COOL AND FINE +++++++++++++++++++++++++
// Nice looking start (TM)
Action = aWalkTo;
Action_Verb = "Walk to";
Action_Object = "";
mouse.Mode = eModeWalkto;
lChangeP1.Text = PLAYER_1ID.Name; lChangeP1.TextColor = COLOR_CHANGE_P_NORMAL;
lChangeP2.Text = PLAYER_2ID.Name; lChangeP2.TextColor = COLOR_CHANGE_P_NORMAL;
lChangeP3.Text = PLAYER_3ID.Name; lChangeP3.TextColor = COLOR_CHANGE_P_NORMAL;
// Erase the actual player button
if (player.Name == lChangeP1.Text) {bChangeP1.Visible = false; lChangeP1.Visible = false;}
if (player.Name == lChangeP2.Text) {bChangeP2.Visible = false; lChangeP2.Visible = false;}
if (player.Name == lChangeP3.Text) {bChangeP3.Visible = false; lChangeP3.Visible = false;}
// Erase contains of the top line
LBL_MESSAGE_TOP.Text = "";
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function repeatedly_execute() {
// put anything you want to happen every game cycle, even when
// the game is paused, here
if (IsGamePaused() == 1) return;
// put anything you want to happen every game cycle, but not
// when the game is paused, here
//*************************************************
// Because There is of Scrolling Rooms
int RPosX = mouse.x + GetViewportX();
int RPosY = mouse.y + GetViewportY();
String Ecran= Game.GetLocationName(mouse.x, mouse.y);
String Verbe_Aff = Action_Verb;
//*************************************************
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++ STEP 1 - AUTO_COLOR THE GUI
// ACTION LINE
// PUSH
// PULL
// GIVE
// -------------------------------------------------------------
// TOP-LEFT INVENTORY |UP BUTTON | TOP-RIGHT INVENTORY
// DOWN-LEFT INVENTORY |D. BUTTON | BOTTOM-RIGHT INVENTORY
// -------------------------------------------------------------
int TOP_ACT_LINE = gActionLine.Y;
int BOT_ACT_LINE = gActionLine.Y + gActionLine.Height;
int TOP_ROW_TOP = gMainGui.Y + cinvent1hg.Y;
int TOP_ROW_BTM = gMainGui.Y+ cinvent1hg.Y + cinvent1hg.Height -1;
int BTM_ROW_TOP = gMainGui.Y + cinvent3bg.Y;
//no need for BTM_ROM_BTM (nothing else down here)
int ROW_P1 = gMainGui.Y + bChangeP1.Y;
int ROW_P2 = gMainGui.Y + bChangeP2.Y;
int ROW_P3 = gMainGui.Y + bChangeP3.Y;
if (mouse.Visible == true) // if the mouse is not visible then it will no bother with that
{
// Top to down
if (mouse.y >= TOP_ACT_LINE && mouse.y < BOT_ACT_LINE){ LblAction.TextColor = COLOR_ACT_LINE_MOUSEOVER; Action_Object="";}
else LblAction.TextColor = COLOR_ACT_LINE_NORMAL;
if (mouse.y >= BTM_ROW_TOP && mouse.x < bINV_Down.X && linv3bg.Text!=null) {linv3bg.TextColor = COLOR_INV_MOUSEOVER;Action_Object = linv3bg.Text;}
else linv3bg.TextColor = COLOR_INV_NORMAL;
if (mouse.y >= BTM_ROW_TOP && mouse.x > bINV_Down.X+bINV_Down.Width&& linv4bd.Text!=null){ linv4bd.TextColor = COLOR_INV_MOUSEOVER;Action_Object = linv4bd.Text;}
else linv4bd.TextColor = COLOR_INV_NORMAL;
if (mouse.y >= TOP_ROW_TOP && mouse.x < bINV_Down.X && mouse.y <= TOP_ROW_BTM&& linv1hg.Text!=null){ linv1hg.TextColor = COLOR_INV_MOUSEOVER;Action_Object = linv1hg.Text;}
else linv1hg.TextColor = COLOR_INV_NORMAL;
if (mouse.y >= TOP_ROW_TOP && mouse.x > bINV_Down.X+bINV_Down.Width && mouse.y <= TOP_ROW_BTM && linv2hd.Text!=null){ linv2hd.TextColor = C64COLOR_YELLOW;Action_Object = linv2hd.Text;}
else linv2hd.TextColor = COLOR_INV_NORMAL;
if (mouse.x >= bChangeP1.X)
{
if (mouse.y >= ROW_P1 && mouse.y < ROW_P2) lChangeP1.TextColor = COLOR_CHANGE_P_MOUSEOVER;
else lChangeP1.TextColor = COLOR_CHANGE_P_NORMAL;
if (mouse.y >= ROW_P2 && mouse.y < ROW_P3) lChangeP2.TextColor = COLOR_CHANGE_P_MOUSEOVER;
else lChangeP2.TextColor = COLOR_CHANGE_P_NORMAL;
if (mouse.y >= ROW_P3 && mouse.y < ROW_P3+ bChangeP3.Height) lChangeP3.TextColor = COLOR_CHANGE_P_MOUSEOVER;
else lChangeP3.TextColor = COLOR_CHANGE_P_NORMAL;
}
else
{
lChangeP1.TextColor = COLOR_CHANGE_P_NORMAL;
lChangeP2.TextColor = COLOR_CHANGE_P_NORMAL;
lChangeP3.TextColor = COLOR_CHANGE_P_NORMAL;
}
if (mouse.y < TOP_ROW_TOP) Action_Object=""; // Remove selection
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//-------------------------------------------------
if (Action_Object == null) Action_Object = "";
if (Ecran == null) Ecran = "";
if (Action_Verb == null || Action_Verb == "") {Action_Verb = "Walk to (acV)"; Action = aWalkTo; mouse.Mode = eModeWalkto;}
String Line = "";
//-------------------------------------------------
// +++++++++++ NOW LET'S UPDATE THAT ACTION LINE
if (Action == aGive){
if (GetLocationType(mouse.x, mouse.y) != eLocationCharacter) Ecran = ""; // Can't give to object or hotspot
if (player.ActiveInventory == null && Action_Object == "") Line = String.Format("Give ");
else if (player.ActiveInventory == null && Action_Object != "") Line = String.Format("Give %s",Action_Object);
else if (player.ActiveInventory != null) Line = String.Format("Give %s to %s",player.ActiveInventory.Name, Ecran);
}
else if (Action ==aUse)
{
if (player.ActiveInventory == null && Action_Object == "") Line = String.Format("Use ");
else if (player.ActiveInventory == null && Action_Object != "") Line = String.Format("Use %s", Action_Object);
else if (player.ActiveInventory != null && Action_Object == "") Line = String.Format("Use %s with %s",player.ActiveInventory.Name, Ecran);
else if (player.ActiveInventory != null && Action_Object != "")Line = String.Format("Use %s with %s",player.ActiveInventory.Name, Action_Object);
}
else
{
if (Ecran == "") Ecran = Action_Object; // olny here (can't give with inventory)
Line = String.Format("%s %s",Action_Verb, Ecran);
}
LblAction.Text = Line;
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function repeatedly_execute_always()
{
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// STEP 1 - Update Inventory buttons Up and Down
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (gMainGui.Visible == true) // If not visible, it's a waste of time
{
if (INV_Hidden.TopItem > 0)
btnInvU2.Visible = true;
else
btnInvU2.Visible = false;
if ((INV_Hidden.TopItem + 4) > (INV_Hidden.ItemCount-1))
bINV_Down.Visible = false;
else
bINV_Down.Visible = true;
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// STEP 2 - Update labels of the visible inventory
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++ A - Top-Left Label
if (INV_Hidden.ItemCount>0)
linv1hg.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem].Name;
else
linv1hg.Text ="";
// +++ B - Top-Right Label
if (INV_Hidden.ItemCount>1 && (INV_Hidden.TopItem+1 < INV_Hidden.ItemCount))
linv2hd.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+1].Name;
else
linv2hd.Text ="";
// +++ C - Bottom-Left Label
if (INV_Hidden.ItemCount>2 && (INV_Hidden.TopItem+2 < INV_Hidden.ItemCount))
linv3bg.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+2].Name;
else
linv3bg.Text ="";
// +++ D - Bottom-Right Label
if (INV_Hidden.ItemCount>3 && (INV_Hidden.TopItem+3 < INV_Hidden.ItemCount))
linv4bd.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+3].Name;
else
linv4bd.Text ="";
}
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function show_save_game_dialog()
{
gSaveGame.Visible = true;
// Get the list of save games
lstSaveGamesList.FillSaveGameList();
if (lstSaveGamesList.ItemCount > 0)
{
// If there is at least one, set the default text
// to be the first game's name
txtNewSaveName.Text = lstSaveGamesList.Items[0];
}
else
{
// No save games yet, default empty text.
txtNewSaveName.Text = "";
}
mouse.UseModeGraphic(eModePointer);
}
function show_restore_game_dialog()
{
gRestoreGame.Visible = true;
lstRestoreGamesList.FillSaveGameList();
mouse.UseModeGraphic(eModePointer);
}
function close_save_game_dialog()
{
gSaveGame.Visible = false;
mouse.UseDefaultGraphic();
}
function close_restore_game_dialog()
{
gRestoreGame.Visible = false;
mouse.UseDefaultGraphic();
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function unhandled_event (int what, int type)
{
if (Action == aLookAt) player.Talk ("That looks like nothing dude.");
else if (Action == aOpen) player.Talk("That don't seems to open.");
else if (Action == aPickUp) player.Talk("I can't pick that up.");
else if (Action == aPull || Action==aPush) player.Talk("I can't move that.");
else player.Talk("That dosen't seems to work.");
player.ActiveInventory = null;
}
function UHE()
{
unhandled_event(1, 1);
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Called when a key is pressed. keycode holds the key's ASCII code
function on_key_press(eKeyCode keycode) {
// The following is called before "if game is paused keycode=0", so
// it'll happen even when the game is paused.
if ((keycode == eKeyEscape) && gRestartYN.Visible) {
//Use ESC to cancel restart.
gRestartYN.Visible = false;
// If the panel's not ON, then the player must have gotten here by tapping F9,
// therefore his cursor needs restoring. If the panel IS on, then it doesn't,
// because it's already a pointer. Get used to thinking like this!!
if (!gPanel.Visible) mouse.UseDefaultGraphic();
return;
}
if ((keycode == eKeyEscape) && gPanel.Visible) {
// Use ESC to turn the panel off.
gPanel.Visible = false;
mouse.UseDefaultGraphic();
return;
}
if ((keycode == eKeyEscape) && (gSaveGame.Visible))
{
// Use ESC to close the save game dialog
close_save_game_dialog();
return;
}
if ((keycode == eKeyEscape) && (gRestoreGame.Visible))
{
// Use ESC to close the restore game dialog
close_restore_game_dialog();
return;
}
if (keycode == eKeyReturn) {
// ENTER, in this case merely confirms restart
if (gRestartYN.Visible) RestartGame();
}
if (IsGamePaused() || (IsInterfaceEnabled() == 0))
{
// If the game is paused with a modal GUI on the
// screen, or the player interface is disabled in
// a cut scene, ignore any keypresses.
return;
}
// FUNCTION KEYS AND SYSTEM SHORTCUTS
if (keycode == eKeyEscape) {
// ESC
gPanel.Visible = true;
mouse.UseModeGraphic(eModePointer);
}
if (keycode == eKeyCtrlQ) QuitGame(1); // Ctrl-Q
if (keycode == eKeyF5) show_save_game_dialog(); // F5
if (keycode == eKeyF7) show_restore_game_dialog(); // F7
if (keycode == eKeyF9) {
// F9, asks the player to confirm restarting (so much better to always confirm first)
gRestartYN.Visible = true;
mouse.UseModeGraphic(eModePointer);
}
if (keycode == eKeyF12) SaveScreenShot("scrnshot.bmp"); // F12
// GAME COMMAND SHORTCUTS
if (keycode == 'Q'){Action_Verb = "Push"; Action = aPush; Mouse.Mode = eModePuPuTonTo ;}
if (keycode == 'A'){Action_Verb = "Pull"; Action = aPull; Mouse.Mode = eModePuPuTonTo ;}
if (keycode == 'Z'){Action_Verb = "Give"; Action = aGive; Mouse.Mode = eModeInteract ;}
if (keycode == 'W') {Action_Verb = "Open"; Action = aOpen; Mouse.Mode = eModeOpenClose ;}
if (keycode == 'S') {Action_Verb = "Close"; Action = aClose; Mouse.Mode = eModeOpenClose ;}
if (keycode == 'X') {Action_Verb = "Use"; Action = aPush; Mouse.Mode = eModeInteract ;}
if (keycode == 'E') {Action_Verb = "Walk to"; Action = aWalkTo; Mouse.Mode = eModeWalkto ;}
if (keycode == 'D') {Action_Verb = "Pick up"; Action = aPickUp; Mouse.Mode = eModePickup ;}
if (keycode == 'C') {Action_Verb = "Look At"; Action = aLookAt; Mouse.Mode = eModeLookat ;}
if (keycode == 'R') {Action_Verb = "Talk To"; Action = aTalkTo; Mouse.Mode = eModeTalkto ;}
if (keycode == 'F') {Action_Verb = "Turn on"; Action = aTurnOn; Mouse.Mode = eModePuPuTonTo ;}
if (keycode == 'V') {Action_Verb = "Turn off"; Action = aTurnOff; Mouse.Mode = eModePuPuTonTo ;}
// For extra cursor modes, such as pick up, feel free to add as you will.
// Uncomment the line below if you use the "Pick Up" mode.
//if (keycode == 'P' || keycode == 'G') mouse.Mode=eModePickup;
// DEBUG FUNCTIONS
if (keycode == eKeyCtrlS) Debug(0,0); // Ctrl-S, give all inventory
if (keycode == eKeyCtrlV) Debug(1,0); // Ctrl-V, version
if (keycode == eKeyCtrlA) Debug(2,0); // Ctrl-A, show walkable areas
if (keycode == eKeyCtrlX) Debug(3,0); // Ctrl-X, teleport to room
if (keycode == eKeyCtrlW && game.debug_mode)
player.PlaceOnWalkableArea(); //Ctrl-W, move to walkable area
}
function on_mouse_click(MouseButton button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button == eMouseLeft || button==eMouseRight)
{
//*************************************
// Because There is of Scrolling Rooms
int RPosX = mouse.x + GetViewportX();
int RPosY = mouse.y + GetViewportY();
Character* ThatGuy;
Object* ThatObject;
Hotspot* ThatSpot;
//*************************************
// Case 1 - Click Nowhere gave you walk
if (mouse.Mode != eModeWalkto && Game.GetLocationName(mouse.x, mouse.y) == "")
{
mouse.Mode = eModeWalkto;
Action = aWalkTo;
Action_Verb = "Walk to";
}
else if (mouse.Mode == eModeWalkto)
{
ProcessClick(mouse.x, mouse.y, eModeWalkto);
}
// ++++ AUTO Case 1 - Give olny to Character
// Char Auto Give
else if (Action == aGive)
{
if (player.ActiveInventory != null && GetLocationType(mouse.x, mouse.y) == eLocationCharacter) // automatik
{
ThatGuy = Character.GetAtScreenXY(mouse.x, mouse.y);
if (ThatGuy == cRazor || ThatGuy == cHoagie || ThatGuy == cSyd)
{
if (ThatGuy.x > player.x+30)player.Walk(ThatGuy.x-30, ThatGuy.y, eBlock, eWalkableAreas);
else if (ThatGuy.x < player.x +30)player.Walk(ThatGuy.x+30, ThatGuy.y, eBlock, eWalkableAreas);
else {} // don't move they are exanging stuff
player.FaceCharacter(ThatGuy, eBlock);
ThatGuy.FaceCharacter(player, eBlock);
ThatGuy.AddInventory(player.ActiveInventory);
player.LoseInventory(player.ActiveInventory);
}
else // Give to Other Character
{
// ThatGuy.RunInteraction(eModeUseinv);
ProcessClick(RPosX, RPosY, mouse.Mode);
}
}
else {} // Don't give it's an object or an hospot
}
// Any others verb or action
else
{
ProcessClick(RPosX, mouse.y, mouse.Mode );
}
}
else if (button == eMouseMiddle) {ProcessClick(mouse.x, mouse.y, eModeWalkto); }
else if (button == eMouseWheelNorth) {
// Mouse-wheel up, cycle cursors
// If mode isn't WALK, set the previous mode (notice usage of numbers instead
// of eNums, when it suits us)...
if (mouse.Mode>0) mouse.Mode=mouse.Mode-1;
else
{
// ...but if it is WALK mode...
if (player.ActiveInventory!=null)
{
//...and the player has a selected inventory item, set mouse mode to UseInv.
mouse.Mode=eModeUseinv;
}
else
{
// If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
mouse.Mode=eModeTalkto;
}
}
}
}
//START OF CONTROL PANEL FUNCTIONS
function btnSave_OnClick(GUIControl *control, MouseButton button)
{
gPanel.Visible = false;
mouse.UseDefaultGraphic();
Wait(1);
}
function btnQuit_OnClick(GUIControl *control, MouseButton button)
{
gPanel.Visible = false;
Wait(1);
QuitGame(1);
gPanel.Visible = true;
mouse.UseModeGraphic(eModePointer);
}
function btnLoad_OnClick(GUIControl *control, MouseButton button)
{
gPanel.Visible = false;
mouse.UseDefaultGraphic();
Wait(1);
}
function btnResume_OnClick(GUIControl *control, MouseButton button)
{
gPanel.Visible = false;
mouse.UseDefaultGraphic();
}
function sldMusic_OnChange(GUIControl *control)
{
SetMusicMasterVolume(sldMusic.Value);
}
function sldSound_OnChange(GUIControl *control)
{
// This sets the sound volume. Note it'll also affect MOD and XM music - read the manual
SetSoundVolume(sldSound.Value);
}
function sldVoice_OnChange(GUIControl *control)
{
// Sets voice volume. Note that we don't check for the existence of speech.vox -
// we did that in game_start, so if it's not there the slider won't even be available.
SetSpeechVolume(sldVoice.Value);
}
function btnVoice_OnClick(GUIControl *control, MouseButton button)
{
// Note that we don't check for the existence of speech.vox - we did that in game_start,
// so if it's not there the button won't even be available.
if (btnVoice.Text == "Voice and Text") {
SetVoiceMode(eSpeechVoiceOnly);
btnVoice.Text = "Voice only";
}
else if (btnVoice.Text == "Voice only") {
SetVoiceMode(eSpeechTextOnly);
btnVoice.Text = "Text only";
}
else if (btnVoice.Text == "Text only") {
SetVoiceMode(eSpeechVoiceAndText);
btnVoice.Text = "Voice and Text";
}
}
function sldGamma_OnChange(GUIControl *control)
{
// Set the gamma. Note there's no need to check for anything else, as we ensured,
// in game_start, that the slider won't even appear if it's not possible to do this.
System.Gamma = sldGamma.Value;
}
function btnDefault_OnClick(GUIControl *control, MouseButton button)
{
// Reset everything to default. You'll have to edit these as well as the sliders
// if you'd rather have different default parameters.
SetMusicMasterVolume(100);
sldMusic.Value = 200;
sldSound.Value = 200;
SetSoundVolume(200);
sldSpeed.Value = 40;
SetGameSpeed(40);
if (IsSpeechVoxAvailable()) {
SetVoiceMode(eSpeechVoiceAndText);
btnVoice.Text = "Voice and Text";
sldVoice.Value = 255;
SetSpeechVolume(255);
}
if (System.SupportsGammaControl) {
System.Gamma = 100;
sldGamma.Value = 100;
}
}
//END OF CONTROL PANEL FUNCTIONS
function sldSpeed_OnChange(GUIControl *control)
{
SetGameSpeed(sldSpeed.Value);
}
function btnRestart_OnClick(GUIControl *control, MouseButton button)
{
gRestartYN.Visible=true;
}
function btnRestartYes_OnClick(GUIControl *control, MouseButton button)
{
RestartGame();
}
function btnRestartNo_OnClick(GUIControl *control, MouseButton button)
{
gRestartYN.Visible = false;
// If the panel's not ON, then the player must have gotten here by tapping F9,
// therefore his cursor needs restoring. If the panel IS on, then it doesn't,
// because it's already a pointer. Get used to thinking like this!!
if (!gPanel.Visible) mouse.UseDefaultGraphic();
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// The folowings are For The save / Load dialogs
function btnCancelSave_OnClick(GUIControl *control, MouseButton button)
{
close_save_game_dialog();
}
function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
int i = 0;
while (i < lstSaveGamesList.ItemCount)
{
if (lstSaveGamesList.Items == txtNewSaveName.Text)
{
gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots;
}
i++;
}
SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
close_save_game_dialog();
}
function btnCancelRestore_OnClick(GUIControl *control, MouseButton button)
{
close_restore_game_dialog();
}
function btnRestoreGame_OnClick(GUIControl *control, MouseButton button)
{
if (lstRestoreGamesList.SelectedIndex >= 0)
{
RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex]);
}
close_restore_game_dialog();
}
function lstSaveGamesList_OnSelectionCh(GUIControl *control)
{
txtNewSaveName.Text = lstSaveGamesList.Items[lstSaveGamesList.SelectedIndex];
}
function txtNewSaveName_OnActivate(GUIControl *control)
{
// Pressing return in the text box simulates clicking the Save button
btnSaveGame_OnClick(control, eMouseLeft);
}
function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
if (lstSaveGamesList.SelectedIndex >= 0)
{
DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
lstSaveGamesList.FillSaveGameList();
}
}
// +++ End of the Save / load dialog
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++ ALL BUTTONS AND OPTIONS TO THE C64 GUI ARE DOWN HERE +++++++++++++++
// +++++++ Col1
function bPush_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Push";
Action = aPush;
Mouse.Mode = eModePuPuTonTo ; }
function bPull_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Push";
Action = aPush;
Mouse.Mode = eModePuPuTonTo ; }
function bGive_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Give";
Action = aGive;
Mouse.Mode = eModeInteract ; }
// +++++++ Col2
function bOpen_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Open";
Action = aOpen;
Mouse.Mode = eModeOpenClose ;}
function bClose_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Close";
Action = aClose;
Mouse.Mode = eModeOpenClose ; }
function bUse_OnClick(GUIControl *control, MouseButton button){
Action_Verb = "Use";
Action = aUse;
Mouse.Mode = eModeInteract ;}
// +++++++ Col3
function bWalkTo_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Walk to";
Action = aWalkTo;
Mouse.Mode = eModeWalkto ; }
function bPickUp_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Pick up";
Action = aPickUp;
Mouse.Mode = eModePickup ; }
function bLookAt_OnClick(GUIControl *control, MouseButton button){
Action_Verb = "Look at";
Action = aLookAt;
Mouse.Mode = eModeLookat ;}
// +++++++ Col4
function bTalkTo_OnClick(GUIControl *control, MouseButton button){
Action_Verb = "Talk to";
Action = aTalkTo;
Mouse.Mode = eModeTalkto ;}
function bTurnOn_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Turn on";
Action = aTurnOn;
Mouse.Mode = eModePuPuTonTo; }
function bTurnOff_Click(GUIControl *control, MouseButton button) {
Action_Verb = "Turn off";
Action = aTurnOff;
Mouse.Mode = eModePuPuTonTo; }
function btnInvU2_OnClick(GUIControl *control, MouseButton button){Display("here");INV_Hidden.ScrollUp();}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++ Button for changing the player
function bChangeP1_OnClick(GUIControl *control, MouseButton button){
New_Player(PLAYER_1ID);}
function bChangeP2_OnClick(GUIControl *control, MouseButton button){
New_Player(PLAYER_2ID);}
function bChangeP3_OnClick(GUIControl *control, MouseButton button){
New_Player(PLAYER_3ID);}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function cinvent1hg_Click(GUIControl *control, MouseButton button) {
if (INV_Hidden.ItemCount>0 && (INV_Hidden.TopItem < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive) && player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem];
mouse.Mode = eModeUseinv;}
else
if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem].RunInteraction(mouse.Mode);
}
}
function cinvent2hd_Click(GUIControl *control, MouseButton button) {
if (INV_Hidden.ItemCount>1 && (INV_Hidden.TopItem+1 < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive)&& player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+1];
mouse.Mode = eModeUseinv;}
else
if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+1].RunInteraction(mouse.Mode);
}
}
function cinvent3bg_Click(GUIControl *control, MouseButton button) {
if (INV_Hidden.ItemCount>2 && (INV_Hidden.TopItem+2 < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive)&& player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+2];
mouse.Mode = eModeUseinv;}
else
if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+2].RunInteraction(mouse.Mode);// item sur item
}
}
function cinvent4bd_Click(GUIControl *control, MouseButton button) {
if (INV_Hidden.ItemCount>3 && (INV_Hidden.TopItem+3 < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive)&& player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+3];
mouse.Mode = eModeUseinv;}
else
if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+3].RunInteraction(mouse.Mode);
}
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++ Exporting stuff
// Cool functions
export Black;
export Back;
export UHE;
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function iKey_Look()
{
player.Talk("It's a glowing key.");
}
function iChainsaw_Interact()
{
player.Talk("The chainsaw is out of gaz!");
}
function iDeadHamster_UseInv()
{
if (player.ActiveInventory == iGreenCrystal)
{
player.Talk("Yeah I'm using the green cristal on the Dead Hamster!");
Black();
Wait(40);
Back();
player.Talk("Wow! it Works!");
player.LoseInventory(iDeadHamster);
player.AddInventory(iHamsterAlive);
}
else
{
UHE();
}
}
function bINV_Down_OnClick(GUIControl *control, MouseButton button)
{
INV_Hidden.ScrollDown();
}
function dialog_request(int param) {
}[/ags]
Zusätzlich hat er noch ein Keyboard-Script eingefügt:
Keyboard102.ash
[ags]/ Script header for module 'KeyboardMovement'
#define KeyboardMovement_VERSION 101
enum KeyboardMovement_Modes {
eKeyboardMovement_None,
eKeyboardMovement_Tapping,
eKeyboardMovement_Pressing
};
struct KeyboardMovement {
import static function SetMode(KeyboardMovement_Modes mode);
};
[/ags]
Keyboard102.asc
[ags]// Main script for module 'KeyboardMovement'
//****************************************************************************************************
// DEFINITIONS
//****************************************************************************************************
#define DISTANCE 10000// distance player walks in Tapping mode before he stops
enum KeyboardMovement_Directions {
eKeyboardMovement_Stop,
eKeyboardMovement_DownLeft,
eKeyboardMovement_Down,
eKeyboardMovement_DownRight,
eKeyboardMovement_Left,
eKeyboardMovement_Right,
eKeyboardMovement_UpLeft,
eKeyboardMovement_Up,
eKeyboardMovement_UpRight
};
//****************************************************************************************************
// VARIABLES
//****************************************************************************************************
// keycodes as variables for future key customization functions (static variables?):
int KeyboardMovement_KeyDown = 380; // down arrow
int KeyboardMovement_KeyLeft = 375; // left arrow
int KeyboardMovement_KeyRight = 377; // right arrow
int KeyboardMovement_KeyUp = 372; // up arrow
int KeyboardMovement_KeyDownRight = 381; // PgDn (numpad)
int KeyboardMovement_KeyUpRight = 373; // PgUp (numpad)
int KeyboardMovement_KeyDownLeft = 379; // End (numpad)
int KeyboardMovement_KeyUpLeft = 371; // Home (numpad)
int KeyboardMovement_KeyStop = 376; // 5 (numpad)
KeyboardMovement_Modes KeyboardMovement_Mode = eKeyboardMovement_None; // stores current keyboard control mode (disabled by default)
KeyboardMovement_Directions KeyboardMovement_CurrentDirection = eKeyboardMovement_Stop; // stores current walking direction of player character
//****************************************************************************************************
// USER FUNCTIONS
//****************************************************************************************************
//====================================================================================================
static function KeyboardMovement::SetMode(KeyboardMovement_Modes mode) {
KeyboardMovement_Mode = mode;
}
//====================================================================================================
// key customization functions here
//====================================================================================================
//****************************************************************************************************
// EVENT HANDLER FUNCTIONS
//****************************************************************************************************
//====================================================================================================
function repeatedly_execute() {
//--------------------------------------------------
// Pressing mode
//--------------------------------------------------
if ((IsGamePaused() == true) || (KeyboardMovement_Mode != eKeyboardMovement_Pressing) || (IsInterfaceEnabled() == false) || (player.on == false)) return 0;
// if game is paused, module or mode disabled, interface disabled or player character hidden, quit function
KeyboardMovement_Directions newdirection; // declare variable storing new direction
// get new direction:
if ( ((IsKeyPressed(KeyboardMovement_KeyDown)) && (IsKeyPressed(KeyboardMovement_KeyRight))) || (IsKeyPresse
-
Nochmal eine Sache, die mir aufgefallen ist:
In der C64-Version von Maniac Mansion fadet der Bildschirm unabhängig vom GUI.
Sprich also: Das Fade-In und Fade-Out beim Raumwechsel beschränkt sich nur auf die Kulisse, der Raumgrafik aber nicht auf den gesamten Screen.
Bei AGS wird standardgemäß der komplette Bildschirm incl. GUI gefadet.
Lässt sich das bei AGS so abändern, dass GUIs vom Fade-In und Fade-Out NICHT mit einbezogen werden?`
Ist zwar nur ne Spielerei, würd aber den C64-Effekt nochmals verbessern.
Danke schon mal im voraus!
BG
der Volltanker
-
Bei AGS wird standardgemäß der komplette Bildschirm incl. GUI gefadet.
Lässt sich das bei AGS so abändern, dass GUIs vom Fade-In und Fade-Out NICHT mit einbezogen werden?`
Schau mal bei dir(also im AGS-Editor) in den "General Settings" nach und dort in der Rubrik "Visual". Hier gibt es die Zeile "Default transition when changing rooms".
Wenn dort "CrossFade" eingetragen ist hast du den Effekt den du haben willst. Wenn "FadeOutAndIn" eingetragen ist wird das GUI ebenfalls ein- und ausgeblendet.
War es das was du gesucht hast?
-
Ne, das was ich meine, lässt sich über die Settings so nicht einstellen.
Schau mal hier auf diesem Video (ist original C64)
Da siehst Du, wie beim Raumwechsel oben nur die Raumgrafik gefadet wird. Das GUI bleibt von diesem Fading unberührt.
-
Da siehst Du, wie beim Raumwechsel oben nur die Raumgrafik gefadet wird. Das GUI bleibt von diesem Fading unberührt.
Ich glaub ich weiß jetzt was du mit "Fading" meinst. Meinst du den Effekt das die Raumgrafik von außen nach innen immer mehr schwarz wird bis keine Raumgrafik mehr zu sehen ist? Diesen Effekt habe ich bei AGS nicht gefunden. Ich habe auch mal die anderen Transitionen ausprobiert und da ist dieser Effekt nicht dabei.
Aber bei CrossFade bleibt das GUI auf jeden Fall vom Fading unberührt, so ist es zumindest bei AGS 3.2.1
Welche AGS Version benutzt du?
-
Ja. Genau diesen Effekt meinte ich.
Ich nutze auch AGS 3.2.1
-
Dann würde ich auf Anhieb sagen das man diesen Effekt irgendwie bei AGS nachladen muss damit man diesen dann bei den General Settings unter Transitionen beim Raumwechsel auswählen kann. Im Spiel selbst wird das wahrscheinlich nicht gehen zumal auch alle anderen Raumwechseleffekte bei den General Settings einzustellen sind.
Hast du schon mal auf der AGS Webseite geschaut ob es da was gibt was man nachinstallieren kann? Ich war jetzt zufaul um da nach zu schauen. Oder, wenn deine Englischkenntnisse das mitmachen, müsstest du mal im AGS Forum diese Frage stellen.
-
:-X
-
Es gibt keine Effekte zum Nachinstallieren, zumindest wäre mir das völlig neu.
AGS fadet immer den kompletten Bildschirm; auch bei Crossfade wird alles inkl. GUI gefadet, aber das fällt natürlich bei Bereichen, die gleich bleiben, nicht auf.
Man kann den Effekt relativ simpel selbst nachbauen, indem man eine eigene FadeIn/Out Funktion schreibt und diese vor und nach Raumwechseln aufruft.
-
Danke bis dahin schon mal!
Ich habe mir überlegt, ob es nicht auch möglich wäre, einen Fader als GUI über der Raumgrafik überzulappen.
Bin mir jetzt aber nicht genau sicher, inwiefern es möglich ist ein GUI zu animieren.
Wenn man sich überlegt, haben die auf dem C64 da schon etwas richtig aufwändiges programmiert.