![]() |
Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldfeld)
also wenn man die zahl 1-12trifft, dann soll der betrag in dem entsprechendem feld(first) x3 genommen werden und zu einem (money)editfeld hinzugefügt werden.
ich kriegs irgendwie net hin... könnt ihr mir helfen?
Delphi-Quellcode:
money.Text:=strtofloat(floattostr(money)+((floattostr(first))*3));
first.text:='0'; der fehler "[Fehler] Unit4.pas(82): E2250 Es gibt keine überladene Version von 'FloatToStr', die man mit diesen Argumenten aufrufen kann" |
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
Was für ein Typ haben money und first? Es muß money.Text o.ä. heißen.
|
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
Delphi-Quellcode:
hm hier is alles was ich hab aber das stimmt hinten und vorne nicht :oops:
procedure TForm4.LOSClick(Sender: TObject);
var GELD, y : integer; begin ZAHL.caption:=floattostr(int(random*36)); y:=floattostr(ZAHL.caption); IF (y>0) AND (y<13) THEN BEGIN money.Text:=strtofloat(floattostr(money.text)+((floattostr(first.caption))*3)); first.text:='0'; |
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
Was für einen Typ haben jetzt money und first?
Tedit?, TLabel? Außerdem hast du die Funktionen vertauscht:
Delphi-Quellcode:
money.Text:=FloatToStr(StrToFloat(money.text)+((StrToFloat(first.caption))*3));
|
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
danke :-D das kalppt jetzt und das mit edit und label hatte ich verwechselt aber dies klappt nun auch...
was noch nicht geht ist der teil hier:
Delphi-Quellcode:
ich will eine zufallszahl erstellen mit 36zahlen erstellen und diese ist halt als variable notwendig und soll auch angezeigt werden (label "Zahl")
ZAHL.caption:=floattostr(int(random*36));
y:=floattostr(ZAHL.caption); |
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
Delphi-Quellcode:
ZAHL.caption:=IntToStr(int(random*36));
y:=StrToFloat(ZAHL.caption); |
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
hat sich erledigt
|
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
Delphi-Quellcode:
ZAHL.caption:=IntToStr(Trunc(random*36));
Delphi-Quellcode:
oder y als Extended deklarieren
y:=StrToInt(ZAHL.caption);
|
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
Delphi-Quellcode:
so hatte ichs jetzt gemacht
ZAHL.caption:=floatToStr(int(random*36));
y:=StrToint(ZAHL.caption); was aber nicht klappt ist die else abfrage :(
Delphi-Quellcode:
begin
ZAHL.caption:=floatToStr(int(random*36)); y:=StrToint(ZAHL.caption); IF (y>0) AND (y<13) THEN money.Text:=FloatToStr(StrToFloat(money.text)+((StrToFloat(first.text))*3)); first.text:='0'; ELSE money.Text:=FloatToStr(StrToFloat(money.text)-(StrToFloat(first.text)); first.text:='0'; end; |
Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
Ohne mir diesen Code großartig angeschaut zu haben, ist mir aufgefallen, dass du begin und end; vergessen hast. Das muss so aussehen:
Delphi-Quellcode:
Aber wie schon gesagt: ich habe ihn mir wirklich nicht großartig angeschaut, mir ist nur diese Sache aufgefallen, ich hoffe, ich konnte helfen, wenn nicht, dann sry.
begin
zahl.Caption := FloatToStr(int(random*36)); y := StrToint(zahl.Caption); if (y > 0) and (y < 13) then begin money.Text := FloatToStr(StrToFloat(money.text)+((StrToFloat(first.text))*3)); first.text := '0'; end else begin money.Text := FloatToStr(StrToFloat(money.text)-(StrToFloat(first.text)); first.text := '0'; end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:20 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz