Author Topic: How to Print VCE Variables in Print Bricks?  (Read 2409 times)

For example, I am making a lotto machine. Whenever the lever is pulled, I want it to show who pulled the lever in print bricks, so people know who exactly got the prize

We'd need to know how you are using events to better apply this. Can you post the events you've got so far so we know where to go from?

Also, brings up difficulty in people with special characters or very long names. How would you like that to be handled?

We'd need to know how you are using events to better apply this.
all i know is that this is possible with just default events and VCE

possible, yes
easily, probably not

so far with fiddling I've found a few things (using brick variables for testing)

VCE_ifVariable:
== is exact match
!= is not exact match
~= is contains
these are mostly useless for us to figure out what the first letter are

VCE_modVariable:
length changes the variable to be the length of the string it was
words selects the first word (can't figure out how to get it to do anything else lol)
character searches the variable for the character, then sets it to that and the rest of the string (getting rid of whatever was before the character)

so based on these I've figured out a way to do it, but it really isn't pretty (making it only for letters right now)
set the player's name to variable NAME (and set it to lowercase to make it easier)
set variable LENGTH equal to NAME
run modvar length on LENGTH to get the length
set varaibles A-Z (all 26 lol) to NAME
run character on A-Z
run LENGTH on A-Z
check for which A-Z is equal to LENGTH, this is the first letter
check which A-Z that is not the first letter is the lowest, that is the new NAME, and LENGTH - the new NAME's LENGTH is how many of the first letter are in a row

it's complicated

might be easier to avoid using printbricks altogether and use a chat mod to print the player's name to minigame chat

all i know is that this is possible with just default events and VCE
Yea, it's very possible, though like phflack showed,
it's complicated

I have a distinct memory of an event that would check for player info and be able to be used in this. I'll look into it more tomorrow

I have a distinct memory of an event that would check for player info and be able to be used in this. I'll look into it more tomorrow
VCE can get the player name
it's easier to print it out in a chat message rather than print it out using print bricks

u could just use minigame > bottomprint if youre within x blocks of the machine

easier solutions would be to just bottomprint the name (untested, but this is about how it would work)
lottery brick:
input>named_brick[display brick]>vce_modvariable[name][set][<var:cl:name>]

display brick:
input>client>bottomprint[<var:br:name> won the lottery]

or use BLIDs instead of names, which would work for bottom printing or for displaying with print bricks
using BLIDs would be more compact and take a lot less space than names (as well as much easier to implement), but is harder to figure out who is who

VCE can get the player name
Outside of that, I mean.
Remember an event that simplified things like these. Maybe am just imagining.

Use the setPrintText event from some really old add-on. It lets you print stuff (including vce replacers) to a row of print bricks.

Use the setPrintText event from some really old add-on. It lets you print stuff (including vce replacers) to a row of print bricks.
forget dude seriously? i've had that thing for a while and i had no clue it did that

pretty sure setPrintCount is default and sets it to a number
setPrint is an addon and sets the letter/image
and then setPrintText is an addon to do multiple print bricks

probably easier to use the addon than to try and figure it out with just defaults+VCE
if you really want a string -> brick text converter (or number -> brick print count) that's defaults+VCE, I can probably get it to work

forget dude seriously? i've had that thing for a while and i had no clue it did that

Name the leftmost brick in the row of prints and use setPrintText on it

Thanks for the help everybody; the "setPrintText" event was the add-on I was looking for. Apparently I've never heard of the add-on despite being here for a long time. Here's the download for future people.