Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Displaying variable using fpgcrawtext

Author
Message
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 22nd Jan 2011 15:16
I am in urgent need of knowing how to display a variables value using fpgcrawtext.
Something like:



Putting % in front of "money" in fpgcrawtext=money, soits is fpgcrawtext=%money displays random paths to huds loaded in the script.

Any ideas?

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 22nd Jan 2011 15:40
I don't think stock FPSC has any actions that let you convert variables into text, such as Str(money), I'd loved to be proved wrong.

There is a thread on displaying cash as a hud:
http://forum.thegamecreators.com/?m=forum_view&t=130281&b=24

I think the PB mod has this feature.

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 23rd Jan 2011 00:25
Quote: "Putting % in front of "money" in fpgcrawtext=money, soits is fpgcrawtext=%money displays random paths to huds loaded in the script."


That IS very strange... I am not entirely sure what could cause that to happen, but if the PB variable system is fully installed in the official source, then that should have pulled the variable's value and used that instead.

I don't know how much of PB has been put into the official source, but what Ched80 said is correct, PB can display a numeric HUD that uses the value from a variable.


The one and only,


Only those who sow the seeds of their desires will reap their benefits later.
However, I have seeds of my own to tend to. I don't have time to be someone else's watering can.
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 23rd Jan 2011 12:36
Quote: "PB can display a numeric HUD that uses the value from a variable"


I tried that in vanilla FPSC 18 beta 1. It works great on its own, but when putting it together with my mainscript I get an error stating something that "Array does not exist or array subscript out of bounds at line 32056. "

Searched for this line, but since I am not using the latest version nothing of use could be found.

Is there a maximum ammount of global (dimvar) variables that can be used? Tried localvar too, but didnt work either...

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 24th Jan 2011 02:40
You can (theoretically) make as many variables as you'd like using "dimvar". I think your only constraint as far as those go is the amount of memory on the computer.

Hmmm... can you show me the script that gave you the error? Perhaps something went wrong.


The one and only,


Only those who sow the seeds of their desires will reap their benefits later.
However, I have seeds of my own to tend to. I don't have time to be someone else's watering can.
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 27th Jan 2011 09:18
I've done some testing of fpgcrawtext and I've found 2 errors:

I'll edit my post with the actual scripts when I get home, but i'll paraphrase the script in summary:

1. this doesn't print the variable to screen. instead it prints the file path to the "presstoenter.tga" hud.



2. this causes the program to crash



3. This runs OK, but obviously doesn't print the variable to screen



I couldn't see anything obvious in the source code that says this should happen.

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
Errant AI
18
Years of Service
User Offline
Joined: 24th Aug 2006
Location:
Posted: 27th Jan 2011 12:46 Edited at: 27th Jan 2011 13:02
Wildly random guess but the fpgcrawtext=x system is probably like hudshow=x and you can't embed a variable value to be read as text.

In other words..



Ply, Do you remember back when Hockeykid and I were talking to you about strings? They're trying to do the same thing I was
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 27th Jan 2011 13:07 Edited at: 27th Jan 2011 13:10
Yeah - looking at the source code there is no check for "%" or "$", that would otherwise point to a variable, in the fpgcrawtext action

Shame really as the variable check is implemented in a number of other actions and, when combined with str$(), would be really handy for debugging.

Edit:
Actually looking at the code, we could use "huduservar=" and set the hud as numeric. I have't tested this yet, but it might produce the same effect.

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 29th Jan 2011 15:06
I found using "huduservar=" and a numeric was just what I needed.
But sure, an abillity to write variables to the screen would be great

Errant AI
18
Years of Service
User Offline
Joined: 24th Aug 2006
Location:
Posted: 29th Jan 2011 15:13
Check the googlecode logs. I think HK added it
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 29th Jan 2011 19:08
i've tried using 'huduservar=' but I can't get it to work. Could you post an example?

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 29th Jan 2011 19:24
Quote: "Check the googlecode logs. I think HK added it "


I was just about to link to the page
You beat me to it

http://code.google.com/p/fpscreatorengine/source/detail?r=375

Quote: "i've tried using 'huduservar=' but I can't get it to work. Could you post an example?"




Or something the path may not exist since I edited it after using a custom path.

Login to post a reply

Server time is: 2024-11-24 13:55:39
Your offset time is: 2024-11-24 13:55:39