SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Help

Reply
 
Thread Tools Search this Thread
Old 07-07-2017   #1
vinicius
méga trovăo!
 
vinicius's Avatar
Default how i do for the "RUN SCRIPT" work?

How do I display these letters on the screen when I press a button? I did not find any tutorial on this, and I already saw the srb2 wiki about it, but I could not find where he wrote those letters to appear on the screen.
vinicius is offline   Reply With Quote
Old 07-07-2017   #2
Lach
what the thok mate??
 
Lach's Avatar
Default

Your best bet is to check out the Lua HUD functions that the game has to offer. If you're unfamiliar with Lua, it'll probably be pretty hard to understand, so make sure you've learnt a little bit at least before attempting anything involving the HUD.

The most primitive HUD function I can think of that falls under your specifications works like this:

Code:
hud.add(function(v, player, camera)
	if (player.cmd.buttons & BT_JUMP)
		v.drawString(16, 160, "JUMPING")
	else
		v.drawString(16, 160, "NOT JUMPING")
	end
end, "game")
Basically, "v" represents the game's "drawer" (what renders the HUD), and "player" represents the player the drawer is currently running for. This code says, if the player is holding down the jump button, have the drawer print "JUMPING", otherwise (i.e. the player is not holding jump), print "NOT JUMPING".
__________________
My recently released addons:
Player-Colored Weapon Rings
Combine Ring Monitor
Lach is offline   Reply With Quote
Old 07-08-2017   #3
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

...I think he was actually talking about this linedef effect: https://wiki.srb2.org/wiki/Linedef_type_415

In order to make pressing a button run a script using this linedef type, you need to make a "linedef executor". There's a tutorial for making a linedef executor here: https://wiki.srb2.org/wiki/Linedef_executor_tutorial (the example is kind of similar to what you want, except pressing the button opens a door instead of running a script)

Just so you know though, Linedef type 415 only runs text files with a list of console commands, not Lua or SOC. Old level packs that use the "Run Script" linedef, such as Mystic Realm, usually used "cecho" to make text appear in the middle of the screen.

Last edited by Monster Iestyn; 07-08-2017 at 12:53 AM.
Monster Iestyn is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:49 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.